Stripe.pm

filter: Statementstmt 38.7% 1923 / 4960 Branchbran 1.4% 40 / 2800 Conditioncond 4.1% 15 / 364 MC/DCmcdc 0.9% 2 / 220 Subroutinesub 88.3% 589 / 667 Podpod 50.0% 1 / 2 totaltotal 28.5% 2570 / 9013 CC 1598 SCAR 63.0
CC
1598
Cov
24%
create_payment_intent
3753.5
update_payment_intent
1756.6
create_product
1678.6
CRAP 542.3
↑ Summary Stripe/Customer.pm »
1 package Net::Stripe;
2 2 $Net::Stripe::VERSION = '0.43';
3 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Class::Load;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Type::Tiny 1.008004;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Kavorka;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use LWP::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use HTTP::Request::Common qw/GET POST DELETE/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use MIME::Base64 qw/encode_base64/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use URI::Escape qw/uri_escape/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use JSON qw/decode_json/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use URI 5.19 qw//;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use DateTime qw//;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use Net::Stripe::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use Net::Stripe::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use Net::Stripe::Token;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶use Net::Stripe::Invoiceitem;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use Net::Stripe::Invoice;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use Net::Stripe::Card;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use Net::Stripe::Source;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use Net::Stripe::Plan;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use Net::Stripe::Product;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use Net::Stripe::Coupon;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use Net::Stripe::Charge;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 2 ▶use Net::Stripe::Customer;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 2 ▶use Net::Stripe::Discount;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use Net::Stripe::Subscription;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 2 ▶use Net::Stripe::Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 2 ▶use Net::Stripe::BalanceTransaction;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 2 ▶use Net::Stripe::List;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 2 ▶use Net::Stripe::LineItem;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 2 ▶use Net::Stripe::Refund;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 2 ▶use Net::Stripe::PaymentMethod;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 2 ▶use Net::Stripe::PaymentIntent;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 # ABSTRACT: API client for Stripe.com
37  
38  
39 2 has 'debug' => (is => 'rw', isa => 'Bool', default => 0, documentation => "The debug flag");
40 2 has 'debug_network' => (is => 'rw', isa => 'Bool', default => 0, documentation => "The debug network request flag");
41 2 has 'api_key' => (is => 'ro', isa => 'Str', required => 1, documentation => "You get this from your Stripe Account settings");
42 2 has 'api_base' => (is => 'ro', isa => 'Str', lazy_build => 1, documentation => "This is the base part of the URL for every request made");
43 2 has 'ua' => (is => 'ro', isa => 'Object', lazy_build => 1, documentation => "The LWP::UserAgent that is used for requests");
44 2 has 'api_version' => (is => 'ro', isa => 'StripeAPIVersion', documentation => "This is the value of the Stripe-Version header you wish to transmit for API calls");
45 2 has 'force_api_version' => (is => 'ro', isa => 'Bool', default => 0, documentation => "Set this to true to bypass the safety checks for API version compatibility.");
46  
47 1 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.4
Pod undocumented
48 1 my ( $self, $args ) = @_;
49 1 $self->_validate_api_version_range();
50 0 $self->_validate_api_version_value();
51 }
52  
53  
54 Charges: {
55 method post_charge(Int :$amount,
56 Str :$currency,
57 StripeCustomerId :$customer?,
58 StripeTokenId|StripeCardId :$card?,
59 StripeTokenId|StripeCardId|StripeSourceId :$source?,
60 Str :$description?,
61 HashRef :$metadata?,
62 Bool :$capture?,
63 Str :$statement_descriptor?,
64 Int :$application_fee?,
65 Str :$receipt_email?
66 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine post_charge: not called CC=49 SCAR=72.7
Branch: 35 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'amount'} ? : 0 0 0
if (exists $_{"amount"}) 0 0 0
Type::Tiny::XS::Int($amount) or _failed_check(18, "Int", $amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'currency'} ? : 0 0 0
if (exists $_{"currency"}) 0 0 0
Type::Tiny::XS::Str($currency) or _failed_check(14, "Str", $currency, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
exists $_{'card'} ? : 0 0 0
if (exists $_{"card"}) 0 0 0
exists $_{'source'} ? : 0 0 0
if (exists $_{"source"}) 0 0 0
exists $_{'description'} ? : 0 0 0
if (exists $_{"description"}) 0 0 0
Type::Tiny::XS::Str($description) or _failed_check(14, "Str", $description, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
Ref::Util::XS::is_plain_hashref($metadata) or _failed_check(27, "HashRef", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'capture'} ? : 0 0 0
if (exists $_{"capture"}) 0 0 0
Type::Tiny::XS::Bool($capture) or _failed_check(10, "Bool", $capture, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'statement_descriptor'} ? : 0 0 0
if (exists $_{"statement_descriptor"}) 0 0 0
Type::Tiny::XS::Str($statement_descriptor) or _failed_check(14, "Str", $statement_descriptor, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'application_fee'} ? : 0 0 0
if (exists $_{"application_fee"}) 0 0 0
Type::Tiny::XS::Int($application_fee) or _failed_check(18, "Int", $application_fee, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'receipt_email'} ? : 0 0 0
if (exists $_{"receipt_email"}) 0 0 0
Type::Tiny::XS::Str($receipt_email) or _failed_check(14, "Str", $receipt_email, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
67  
68 0 ▶ if ( defined( $card ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $card) 0 0 0
69 0 my $card_id_type = Moose::Util::TypeConstraints::find_type_constraint( 'StripeCardId' );
70 0 ▶ if ( defined( $customer ) && ! $card_id_type->check( $card ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $customer and not $card_id_type->check($card)) 0 0 0
Condition0%0/3
defined $customer and not $card_id_type->check($card)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $customer and not $card_id_type->check($card)
defined $customer not $card_id_type->check($card)
Truth table0%0/3
A and not(B)
A= defined $customerB= not $card_id_type->check($card)
ABresult
0X0
100
111
71 0 die Net::Stripe::Error->new(
72 type => "post_charge error",
73 message => sprintf(
74 "Invalid value '%s' passed for parameter 'card'. Charges for an existing customer can only accept a card id.",
75 $card,
76 ),
77 );
78 }
79  
80 0 my $token_id_type = Moose::Util::TypeConstraints::find_type_constraint( 'StripeTokenId' );
81 0 ▶ if ( ! defined( $customer ) && ! $token_id_type->check( $card ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $customer or $token_id_type->check($card)) 0 0 0
Condition0%0/3
defined $customer or $token_id_type->check($card)
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $customer or $token_id_type->check($card)
defined $customer $token_id_type->check($card)
Truth table0%0/3
A or B
A= defined $customerB= $token_id_type->check($card)
ABresult
1X1
011
000
82 0 die Net::Stripe::Error->new(
83 type => "post_charge error",
84 message => sprintf(
85 "Invalid value '%s' passed for parameter 'card'. Charges without an existing customer can only accept a token id.",
86 $card,
87 ),
88 );
89 }
90 }
91  
92 0 ▶ if ( defined( $source ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $source) 0 0 0
93 0 my $card_id_type = Moose::Util::TypeConstraints::find_type_constraint( 'StripeCardId' );
94 0 ▶ if ( defined( $customer ) && ! $card_id_type->check( $source ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $customer and not $card_id_type->check($source)) 0 0 0
Condition0%0/3
defined $customer and not $card_id_type->check($source)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $customer and not $card_id_type->check($source)
defined $customer not $card_id_type->check($source)
Truth table0%0/3
A and not(B)
A= defined $customerB= not $card_id_type->check($source)
ABresult
0X0
100
111
95 0 die Net::Stripe::Error->new(
96 type => "post_charge error",
97 message => sprintf(
98 "Invalid value '%s' passed for parameter 'source'. Charges for an existing customer can only accept a card id.",
99 $source,
100 ),
101 );
102 }
103  
104 0 my $token_id_type = Moose::Util::TypeConstraints::find_type_constraint( 'StripeTokenId' );
105 0 my $source_id_type = Moose::Util::TypeConstraints::find_type_constraint( 'StripeSourceId' );
106 0 ▶ if ( ! defined( $customer ) && ! $token_id_type->check( $source ) && ! $source_id_type->check( $source ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $customer or $token_id_type->check($source) or $source_id_type->check($source)) 0 0 0
Condition0%0/6
defined $customer or $token_id_type->check($source) or $source_id_type->check($source)
l!l&&r!l&&!r
000
defined $customer or $token_id_type->check($source)
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $customer or $token_id_type->check($source) or $source_id_type->check($source)
defined $customer $token_id_type->check($source) $source_id_type->check($source)
Truth table0%0/4
A or B or C
A= defined $customerB= $token_id_type->check($source)C= $source_id_type->check($source)
ABCresult
1XX1
01X1
0011
0000
107 0 die Net::Stripe::Error->new(
108 type => "post_charge error",
109 message => sprintf(
110 "Invalid value '%s' passed for parameter 'source'. Charges without an existing customer can only accept a token id or source id.",
111 $source,
112 ),
113 );
114 }
115 }
116  
117 0 my $charge = Net::Stripe::Charge->new(amount => $amount,
118 currency => $currency,
119 customer => $customer,
120 card => $card,
121 source => $source,
122 description => $description,
123 metadata => $metadata,
124 capture => $capture,
125 statement_descriptor => $statement_descriptor,
126 application_fee => $application_fee,
127 receipt_email => $receipt_email
128 );
129 0 return $self->_post('charges', $charge);
130 }
131  
132 0 ▶ method get_charge(Str :$charge_id) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine get_charge: not called CC=11 SCAR=40.4
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'charge_id'} ? : 0 0 0
if (exists $_{"charge_id"}) 0 0 0
Type::Tiny::XS::Str($charge_id) or _failed_check(14, "Str", $charge_id, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
133 0 return $self->_get("charges/" . $charge_id);
134 }
135  
136 0 ▶ method refund_charge(Net::Stripe::Charge|Str :$charge, Int :$amount?) {
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine refund_charge: not called CC=15 SCAR=47.1
Branch: 11 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'charge'} ? : 0 0 0
if (exists $_{"charge"}) 0 0 0
Type::Tiny::XS::AUTO::TC7($charge) or _failed_check(57, "InstanceOf[\"Net::Stripe::Charge\"]|Str", $charge, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'amount'} ? : 0 0 0
if (exists $_{"amount"}) 0 0 0
Type::Tiny::XS::Int($amount) or _failed_check(18, "Int", $amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
137 0 ▶ if (ref($charge)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $charge) 0 0 0
138 0 $charge = $charge->id;
139 }
140  
141 0 my $refund = Net::Stripe::Refund->new(id => $charge,
142 amount => $amount
143 );
144 0 return $self->_post("charges/$charge/refunds", $refund);
145 }
146  
147 method get_charges(HashRef :$created?,
148 Net::Stripe::Customer|Str :$customer?,
149 Str :$ending_before?,
150 Int :$limit?,
151 0 ▶ Str :$starting_after?) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine get_charges: not called CC=24 SCAR=56.4
Branch: 20 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'created'} ? : 0 0 0
if (exists $_{"created"}) 0 0 0
Ref::Util::XS::is_plain_hashref($created) or _failed_check(27, "HashRef", $created, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(61, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::Str($ending_before) or _failed_check(14, "Str", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::Int($limit) or _failed_check(18, "Int", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::Str($starting_after) or _failed_check(14, "Str", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
152 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
153 0 $customer = $customer->id;
154 }
155 0 my %args = (
156 path => 'charges',
157 created => $created,
158 customer => $customer,
159 ending_before => $ending_before,
160 limit => $limit,
161 starting_after => $starting_after,
162 );
163 0 $self->_get_all(%args);
164 }
165  
166 method capture_charge(
167 Net::Stripe::Charge|Str :$charge!,
168 Int :$amount?,
169 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine capture_charge: not called CC=15 SCAR=47.1
Branch: 11 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'charge'} ? : 0 0 0
if (exists $_{"charge"}) 0 0 0
Type::Tiny::XS::AUTO::TC7($charge) or _failed_check(62, "InstanceOf[\"Net::Stripe::Charge\"]|Str", $charge, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'amount'} ? : 0 0 0
if (exists $_{"amount"}) 0 0 0
Type::Tiny::XS::Int($amount) or _failed_check(18, "Int", $amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
170 0 ▶ if (ref($charge)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $charge) 0 0 0
171 0 $charge = $charge->id;
172 }
173  
174 0 my %args = (
175 amount => $amount,
176 );
177 0 return $self->_post("charges/$charge/capture", \%args);
178 }
179  
180 }
181  
182  
183 2 PaymentIntents: {
184 method create_payment_intent(
185 Int :$amount!,
186 Str :$currency!,
187 Int :$application_fee_amount?,
188 StripeCaptureMethod :$capture_method?,
189 Bool :$confirm?,
190 StripeConfirmationMethod :$confirmation_method?,
191 StripeCustomerId :$customer?,
192 Str :$description?,
193 Bool :$error_on_requires_action?,
194 Str :$mandate?,
195 HashRef :$mandate_data?,
196 HashRef[Str] :$metadata?,
197 Bool :$off_session?,
198 Str :$on_behalf_of?,
199 StripePaymentMethodId :$payment_method?,
200 HashRef :$payment_method_options?,
201 ArrayRef[StripePaymentMethodType] :$payment_method_types?,
202 Str :$receipt_email?,
203 Str :$return_url?,
204 Bool :$save_payment_method?,
205 Str :$setup_future_usage?,
206 HashRef :$shipping?,
207 Str :$statement_descriptor?,
208 Str :$statement_descriptor_suffix?,
209 HashRef :$transfer_data?,
210 Str :$transfer_group?,
211 Bool :$use_stripe_sdk?,
212 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine create_payment_intent: not called CC=87 SCAR=82.3
Branch: 84 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'amount'} ? : 0 0 0
if (exists $_{"amount"}) 0 0 0
Type::Tiny::XS::Int($amount) or _failed_check(18, "Int", $amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'currency'} ? : 0 0 0
if (exists $_{"currency"}) 0 0 0
Type::Tiny::XS::Str($currency) or _failed_check(14, "Str", $currency, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'application_fee_amount'} ? : 0 0 0
if (exists $_{"application_fee_amount"}) 0 0 0
Type::Tiny::XS::Int($application_fee_amount) or _failed_check(18, "Int", $application_fee_amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'capture_method'} ? : 0 0 0
if (exists $_{"capture_method"}) 0 0 0
Type::Tiny::XS::AUTO::TC10($capture_method) or _failed_check(63, "StripeCaptureMethod", $capture_method, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'confirm'} ? : 0 0 0
if (exists $_{"confirm"}) 0 0 0
Type::Tiny::XS::Bool($confirm) or _failed_check(10, "Bool", $confirm, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'confirmation_method'} ? : 0 0 0
if (exists $_{"confirmation_method"}) 0 0 0
Type::Tiny::XS::AUTO::TC10($confirmation_method) or _failed_check(64, "StripeConfirmationMethod", $confirmation_method, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
exists $_{'description'} ? : 0 0 0
if (exists $_{"description"}) 0 0 0
Type::Tiny::XS::Str($description) or _failed_check(14, "Str", $description, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'error_on_requires_action'} ? : 0 0 0
if (exists $_{"error_on_requires_action"}) 0 0 0
Type::Tiny::XS::Bool($error_on_requires_action) or _failed_check(10, "Bool", $error_on_requires_action, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'mandate'} ? : 0 0 0
if (exists $_{"mandate"}) 0 0 0
Type::Tiny::XS::Str($mandate) or _failed_check(14, "Str", $mandate, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'mandate_data'} ? : 0 0 0
if (exists $_{"mandate_data"}) 0 0 0
Ref::Util::XS::is_plain_hashref($mandate_data) or _failed_check(27, "HashRef", $mandate_data, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
Type::Tiny::XS::AUTO::TC11($metadata) or _failed_check(65, "HashRef[Str]", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'off_session'} ? : 0 0 0
if (exists $_{"off_session"}) 0 0 0
Type::Tiny::XS::Bool($off_session) or _failed_check(10, "Bool", $off_session, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'on_behalf_of'} ? : 0 0 0
if (exists $_{"on_behalf_of"}) 0 0 0
Type::Tiny::XS::Str($on_behalf_of) or _failed_check(14, "Str", $on_behalf_of, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'payment_method'} ? : 0 0 0
if (exists $_{"payment_method"}) 0 0 0
exists $_{'payment_method_options'} ? : 0 0 0
if (exists $_{"payment_method_options"}) 0 0 0
Ref::Util::XS::is_plain_hashref($payment_method_options) or _failed_check(27, "HashRef", $payment_method_options, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'payment_method_types'} ? : 0 0 0
if (exists $_{"payment_method_types"}) 0 0 0
Type::Tiny::XS::AUTO::TC13($payment_method_types) or _failed_check(68, "ArrayRef[StripePaymentMethodType]", $payment_method_types, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'receipt_email'} ? : 0 0 0
if (exists $_{"receipt_email"}) 0 0 0
Type::Tiny::XS::Str($receipt_email) or _failed_check(14, "Str", $receipt_email, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'return_url'} ? : 0 0 0
if (exists $_{"return_url"}) 0 0 0
Type::Tiny::XS::Str($return_url) or _failed_check(14, "Str", $return_url, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'save_payment_method'} ? : 0 0 0
if (exists $_{"save_payment_method"}) 0 0 0
Type::Tiny::XS::Bool($save_payment_method) or _failed_check(10, "Bool", $save_payment_method, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'setup_future_usage'} ? : 0 0 0
if (exists $_{"setup_future_usage"}) 0 0 0
Type::Tiny::XS::Str($setup_future_usage) or _failed_check(14, "Str", $setup_future_usage, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'shipping'} ? : 0 0 0
if (exists $_{"shipping"}) 0 0 0
Ref::Util::XS::is_plain_hashref($shipping) or _failed_check(27, "HashRef", $shipping, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'statement_descriptor'} ? : 0 0 0
if (exists $_{"statement_descriptor"}) 0 0 0
Type::Tiny::XS::Str($statement_descriptor) or _failed_check(14, "Str", $statement_descriptor, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'statement_descriptor_suffix'} ? : 0 0 0
if (exists $_{"statement_descriptor_suffix"}) 0 0 0
Type::Tiny::XS::Str($statement_descriptor_suffix) or _failed_check(14, "Str", $statement_descriptor_suffix, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'transfer_data'} ? : 0 0 0
if (exists $_{"transfer_data"}) 0 0 0
Ref::Util::XS::is_plain_hashref($transfer_data) or _failed_check(27, "HashRef", $transfer_data, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'transfer_group'} ? : 0 0 0
if (exists $_{"transfer_group"}) 0 0 0
Type::Tiny::XS::Str($transfer_group) or _failed_check(14, "Str", $transfer_group, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'use_stripe_sdk'} ? : 0 0 0
if (exists $_{"use_stripe_sdk"}) 0 0 0
Type::Tiny::XS::Bool($use_stripe_sdk) or _failed_check(10, "Bool", $use_stripe_sdk, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
213 0 my %args = (
214 amount => $amount,
215 currency => $currency,
216 application_fee_amount => $application_fee_amount,
217 capture_method => $capture_method,
218 confirm => $confirm,
219 confirmation_method => $confirmation_method,
220 customer => $customer,
221 description => $description,
222 error_on_requires_action => $error_on_requires_action,
223 mandate => $mandate,
224 mandate_data => $mandate_data,
225 metadata => $metadata,
226 off_session => $off_session,
227 on_behalf_of => $on_behalf_of,
228 payment_method => $payment_method,
229 payment_method_options => $payment_method_options,
230 payment_method_types => $payment_method_types,
231 receipt_email => $receipt_email,
232 return_url => $return_url,
233 save_payment_method => $save_payment_method,
234 setup_future_usage => $setup_future_usage,
235 shipping => $shipping,
236 statement_descriptor => $statement_descriptor,
237 statement_descriptor_suffix => $statement_descriptor_suffix,
238 transfer_data => $transfer_data,
239 transfer_group => $transfer_group,
240 use_stripe_sdk => $use_stripe_sdk,
241 );
242 0 my $payment_intent_obj = Net::Stripe::PaymentIntent->new( %args );
243 0 return $self->_post("payment_intents", $payment_intent_obj);
244 }
245  
246 method get_payment_intent(
247 StripePaymentIntentId :$payment_intent_id!,
248 Str :$client_secret?,
249 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine get_payment_intent: not called CC=13 SCAR=44.6
Branch: 10 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'payment_intent_id'} ? : 0 0 0
if (exists $_{"payment_intent_id"}) 0 0 0
exists $_{'client_secret'} ? : 0 0 0
if (exists $_{"client_secret"}) 0 0 0
Type::Tiny::XS::Str($client_secret) or _failed_check(14, "Str", $client_secret, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
250 0 my %args = (
251 client_secret => $client_secret,
252 );
253 0 return $self->_get("payment_intents/$payment_intent_id", \%args);
254 }
255  
256 method update_payment_intent(
257 StripePaymentIntentId :$payment_intent_id!,
258 Int :$amount?,
259 Int :$application_fee_amount?,
260 Str :$currency?,
261 StripeCustomerId :$customer?,
262 Str :$description?,
263 HashRef[Str]|EmptyStr :$metadata?,
264 StripePaymentMethodId :$payment_method?,
265 HashRef :$payment_method_options?,
266 ArrayRef[StripePaymentMethodType] :$payment_method_types?,
267 Str :$receipt_email?,
268 Bool :$save_payment_method?,
269 Str :$setup_future_usage?,
270 HashRef :$shipping?,
271 Str :$statement_descriptor?,
272 Str :$statement_descriptor_suffix?,
273 HashRef :$transfer_data?,
274 Str :$transfer_group?,
275 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine update_payment_intent: not called CC=58 SCAR=74.7
Branch: 55 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'payment_intent_id'} ? : 0 0 0
if (exists $_{"payment_intent_id"}) 0 0 0
exists $_{'amount'} ? : 0 0 0
if (exists $_{"amount"}) 0 0 0
Type::Tiny::XS::Int($amount) or _failed_check(18, "Int", $amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'application_fee_amount'} ? : 0 0 0
if (exists $_{"application_fee_amount"}) 0 0 0
Type::Tiny::XS::Int($application_fee_amount) or _failed_check(18, "Int", $application_fee_amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'currency'} ? : 0 0 0
if (exists $_{"currency"}) 0 0 0
Type::Tiny::XS::Str($currency) or _failed_check(14, "Str", $currency, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
exists $_{'description'} ? : 0 0 0
if (exists $_{"description"}) 0 0 0
Type::Tiny::XS::Str($description) or _failed_check(14, "Str", $description, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
exists $_{'payment_method'} ? : 0 0 0
if (exists $_{"payment_method"}) 0 0 0
exists $_{'payment_method_options'} ? : 0 0 0
if (exists $_{"payment_method_options"}) 0 0 0
Ref::Util::XS::is_plain_hashref($payment_method_options) or _failed_check(27, "HashRef", $payment_method_options, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'payment_method_types'} ? : 0 0 0
if (exists $_{"payment_method_types"}) 0 0 0
Type::Tiny::XS::AUTO::TC13($payment_method_types) or _failed_check(68, "ArrayRef[StripePaymentMethodType]", $payment_method_types, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'receipt_email'} ? : 0 0 0
if (exists $_{"receipt_email"}) 0 0 0
Type::Tiny::XS::Str($receipt_email) or _failed_check(14, "Str", $receipt_email, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'save_payment_method'} ? : 0 0 0
if (exists $_{"save_payment_method"}) 0 0 0
Type::Tiny::XS::Bool($save_payment_method) or _failed_check(10, "Bool", $save_payment_method, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'setup_future_usage'} ? : 0 0 0
if (exists $_{"setup_future_usage"}) 0 0 0
Type::Tiny::XS::Str($setup_future_usage) or _failed_check(14, "Str", $setup_future_usage, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'shipping'} ? : 0 0 0
if (exists $_{"shipping"}) 0 0 0
Ref::Util::XS::is_plain_hashref($shipping) or _failed_check(27, "HashRef", $shipping, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'statement_descriptor'} ? : 0 0 0
if (exists $_{"statement_descriptor"}) 0 0 0
Type::Tiny::XS::Str($statement_descriptor) or _failed_check(14, "Str", $statement_descriptor, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'statement_descriptor_suffix'} ? : 0 0 0
if (exists $_{"statement_descriptor_suffix"}) 0 0 0
Type::Tiny::XS::Str($statement_descriptor_suffix) or _failed_check(14, "Str", $statement_descriptor_suffix, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'transfer_data'} ? : 0 0 0
if (exists $_{"transfer_data"}) 0 0 0
Ref::Util::XS::is_plain_hashref($transfer_data) or _failed_check(27, "HashRef", $transfer_data, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'transfer_group'} ? : 0 0 0
if (exists $_{"transfer_group"}) 0 0 0
Type::Tiny::XS::Str($transfer_group) or _failed_check(14, "Str", $transfer_group, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
276 0 my %args = (
277 amount => $amount,
278 application_fee_amount => $application_fee_amount,
279 currency => $currency,
280 customer => $customer,
281 description => $description,
282 metadata => $metadata,
283 payment_method => $payment_method,
284 payment_method_options => $payment_method_options,
285 payment_method_types => $payment_method_types,
286 receipt_email => $receipt_email,
287 save_payment_method => $save_payment_method,
288 setup_future_usage => $setup_future_usage,
289 shipping => $shipping,
290 statement_descriptor => $statement_descriptor,
291 statement_descriptor_suffix => $statement_descriptor_suffix,
292 transfer_data => $transfer_data,
293 transfer_group => $transfer_group,
294 );
295 0 my $payment_intent_obj = Net::Stripe::PaymentIntent->new( %args );
296 0 return $self->_post("payment_intents/$payment_intent_id", $payment_intent_obj);
297 }
298  
299 method confirm_payment_intent(
300 StripePaymentIntentId :$payment_intent_id!,
301 Str :$client_secret?,
302 Bool :$error_on_requires_action?,
303 Str :$mandate?,
304 HashRef :$mandate_data?,
305 Bool :$off_session?,
306 StripePaymentMethodId :$payment_method?,
307 HashRef :$payment_method_options?,
308 ArrayRef[StripePaymentMethodType] :$payment_method_types?,
309 Str :$receipt_email?,
310 Str :$return_url?,
311 Bool :$save_payment_method?,
312 Str :$setup_future_usage?,
313 HashRef :$shipping?,
314 Bool :$use_stripe_sdk?,
315 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine confirm_payment_intent: not called CC=51 SCAR=71.7
Branch: 48 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'payment_intent_id'} ? : 0 0 0
if (exists $_{"payment_intent_id"}) 0 0 0
exists $_{'client_secret'} ? : 0 0 0
if (exists $_{"client_secret"}) 0 0 0
Type::Tiny::XS::Str($client_secret) or _failed_check(14, "Str", $client_secret, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'error_on_requires_action'} ? : 0 0 0
if (exists $_{"error_on_requires_action"}) 0 0 0
Type::Tiny::XS::Bool($error_on_requires_action) or _failed_check(10, "Bool", $error_on_requires_action, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'mandate'} ? : 0 0 0
if (exists $_{"mandate"}) 0 0 0
Type::Tiny::XS::Str($mandate) or _failed_check(14, "Str", $mandate, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'mandate_data'} ? : 0 0 0
if (exists $_{"mandate_data"}) 0 0 0
Ref::Util::XS::is_plain_hashref($mandate_data) or _failed_check(27, "HashRef", $mandate_data, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'off_session'} ? : 0 0 0
if (exists $_{"off_session"}) 0 0 0
Type::Tiny::XS::Bool($off_session) or _failed_check(10, "Bool", $off_session, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'payment_method'} ? : 0 0 0
if (exists $_{"payment_method"}) 0 0 0
exists $_{'payment_method_options'} ? : 0 0 0
if (exists $_{"payment_method_options"}) 0 0 0
Ref::Util::XS::is_plain_hashref($payment_method_options) or _failed_check(27, "HashRef", $payment_method_options, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'payment_method_types'} ? : 0 0 0
if (exists $_{"payment_method_types"}) 0 0 0
Type::Tiny::XS::AUTO::TC13($payment_method_types) or _failed_check(68, "ArrayRef[StripePaymentMethodType]", $payment_method_types, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'receipt_email'} ? : 0 0 0
if (exists $_{"receipt_email"}) 0 0 0
Type::Tiny::XS::Str($receipt_email) or _failed_check(14, "Str", $receipt_email, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'return_url'} ? : 0 0 0
if (exists $_{"return_url"}) 0 0 0
Type::Tiny::XS::Str($return_url) or _failed_check(14, "Str", $return_url, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'save_payment_method'} ? : 0 0 0
if (exists $_{"save_payment_method"}) 0 0 0
Type::Tiny::XS::Bool($save_payment_method) or _failed_check(10, "Bool", $save_payment_method, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'setup_future_usage'} ? : 0 0 0
if (exists $_{"setup_future_usage"}) 0 0 0
Type::Tiny::XS::Str($setup_future_usage) or _failed_check(14, "Str", $setup_future_usage, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'shipping'} ? : 0 0 0
if (exists $_{"shipping"}) 0 0 0
Ref::Util::XS::is_plain_hashref($shipping) or _failed_check(27, "HashRef", $shipping, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'use_stripe_sdk'} ? : 0 0 0
if (exists $_{"use_stripe_sdk"}) 0 0 0
Type::Tiny::XS::Bool($use_stripe_sdk) or _failed_check(10, "Bool", $use_stripe_sdk, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
316 0 my %args = (
317 client_secret => $client_secret,
318 error_on_requires_action => $error_on_requires_action,
319 mandate => $mandate,
320 mandate_data => $mandate_data,
321 off_session => $off_session,
322 payment_method => $payment_method,
323 payment_method_options => $payment_method_options,
324 payment_method_types => $payment_method_types,
325 receipt_email => $receipt_email,
326 return_url => $return_url,
327 save_payment_method => $save_payment_method,
328 setup_future_usage => $setup_future_usage,
329 shipping => $shipping,
330 use_stripe_sdk => $use_stripe_sdk,
331 );
332 0 return $self->_post("payment_intents/$payment_intent_id/confirm", \%args);
333 }
334  
335 method capture_payment_intent(
336 StripePaymentIntentId :$payment_intent_id!,
337 Int :$amount_to_capture?,
338 Int :$application_fee_amount?,
339 Str :$statement_descriptor?,
340 Str :$statement_descriptor_suffix?,
341 HashRef :$transfer_data?,
342 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine capture_payment_intent: not called CC=25 SCAR=57.4
Branch: 22 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'payment_intent_id'} ? : 0 0 0
if (exists $_{"payment_intent_id"}) 0 0 0
exists $_{'amount_to_capture'} ? : 0 0 0
if (exists $_{"amount_to_capture"}) 0 0 0
Type::Tiny::XS::Int($amount_to_capture) or _failed_check(18, "Int", $amount_to_capture, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'application_fee_amount'} ? : 0 0 0
if (exists $_{"application_fee_amount"}) 0 0 0
Type::Tiny::XS::Int($application_fee_amount) or _failed_check(18, "Int", $application_fee_amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'statement_descriptor'} ? : 0 0 0
if (exists $_{"statement_descriptor"}) 0 0 0
Type::Tiny::XS::Str($statement_descriptor) or _failed_check(14, "Str", $statement_descriptor, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'statement_descriptor_suffix'} ? : 0 0 0
if (exists $_{"statement_descriptor_suffix"}) 0 0 0
Type::Tiny::XS::Str($statement_descriptor_suffix) or _failed_check(14, "Str", $statement_descriptor_suffix, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'transfer_data'} ? : 0 0 0
if (exists $_{"transfer_data"}) 0 0 0
Ref::Util::XS::is_plain_hashref($transfer_data) or _failed_check(27, "HashRef", $transfer_data, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
343 0 my %args = (
344 amount_to_capture => $amount_to_capture,
345 application_fee_amount => $application_fee_amount,
346 statement_descriptor => $statement_descriptor,
347 statement_descriptor_suffix => $statement_descriptor_suffix,
348 transfer_data => $transfer_data,
349 );
350 0 return $self->_post("payment_intents/$payment_intent_id/capture", \%args);
351 }
352  
353 method cancel_payment_intent(
354 StripePaymentIntentId :$payment_intent_id!,
355 StripeCancellationReason :$cancellation_reason?,
356 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine cancel_payment_intent: not called CC=13 SCAR=44.6
Branch: 10 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'payment_intent_id'} ? : 0 0 0
if (exists $_{"payment_intent_id"}) 0 0 0
exists $_{'cancellation_reason'} ? : 0 0 0
if (exists $_{"cancellation_reason"}) 0 0 0
Type::Tiny::XS::AUTO::TC14($cancellation_reason) or _failed_check(72, "StripeCancellationReason", $cancellation_reason, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
357 0 my %args = (
358 cancellation_reason => $cancellation_reason,
359 );
360 0 return $self->_post("payment_intents/$payment_intent_id/cancel", \%args);
361 }
362  
363 method list_payment_intents(
364 StripeCustomerId :$customer?,
365 HashRef[Int] :$created?,
366 Str :$ending_before?,
367 Int :$limit?,
368 Str :$starting_after?,
369 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine list_payment_intents: not called CC=22 SCAR=54.9
Branch: 19 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
exists $_{'created'} ? : 0 0 0
if (exists $_{"created"}) 0 0 0
Type::Tiny::XS::AUTO::TC15($created) or _failed_check(73, "HashRef[Int]", $created, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::Str($ending_before) or _failed_check(14, "Str", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::Int($limit) or _failed_check(18, "Int", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::Str($starting_after) or _failed_check(14, "Str", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
370 0 my %args = (
371 customer => $customer,
372 created => $created,
373 ending_before => $ending_before,
374 limit => $limit,
375 starting_after => $starting_after,
376 );
377 0 return $self->_get("payment_intents", \%args);
378 }
379 }
380  
381  
382  
383 2 BalanceTransactions: {
384 0 ▶ method get_balance_transaction(Str :$id) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine get_balance_transaction: not called CC=11 SCAR=40.4
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'id'} ? : 0 0 0
if (exists $_{"id"}) 0 0 0
Type::Tiny::XS::Str($id) or _failed_check(14, "Str", $id, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
385 0 return $self->_get("balance/history/$id");
386 }
387 }
388  
389  
390  
391 2 Customers: {
392 method post_customer(Net::Stripe::Customer|StripeCustomerId :$customer?,
393 Int :$account_balance?,
394 Int :$balance?,
395 Net::Stripe::Token|StripeTokenId :$card?,
396 Str :$coupon?,
397 Str :$default_card?,
398 StripeCardId|StripeSourceId :$default_source?,
399 Str :$description?,
400 Str :$email?,
401 HashRef :$metadata?,
402 Str :$plan?,
403 Int :$quantity?,
404 StripeTokenId|StripeSourceId :$source?,
405 0 ▶ Int|Str :$trial_end?) {
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine post_customer: not called CC=49 SCAR=71.9
Branch: 43 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
exists $_{'account_balance'} ? : 0 0 0
if (exists $_{"account_balance"}) 0 0 0
Type::Tiny::XS::Int($account_balance) or _failed_check(18, "Int", $account_balance, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'balance'} ? : 0 0 0
if (exists $_{"balance"}) 0 0 0
Type::Tiny::XS::Int($balance) or _failed_check(18, "Int", $balance, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'card'} ? : 0 0 0
if (exists $_{"card"}) 0 0 0
exists $_{'coupon'} ? : 0 0 0
if (exists $_{"coupon"}) 0 0 0
Type::Tiny::XS::Str($coupon) or _failed_check(14, "Str", $coupon, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'default_card'} ? : 0 0 0
if (exists $_{"default_card"}) 0 0 0
Type::Tiny::XS::Str($default_card) or _failed_check(14, "Str", $default_card, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'default_source'} ? : 0 0 0
if (exists $_{"default_source"}) 0 0 0
exists $_{'description'} ? : 0 0 0
if (exists $_{"description"}) 0 0 0
Type::Tiny::XS::Str($description) or _failed_check(14, "Str", $description, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'email'} ? : 0 0 0
if (exists $_{"email"}) 0 0 0
Type::Tiny::XS::Str($email) or _failed_check(14, "Str", $email, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
Ref::Util::XS::is_plain_hashref($metadata) or _failed_check(27, "HashRef", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'plan'} ? : 0 0 0
if (exists $_{"plan"}) 0 0 0
Type::Tiny::XS::Str($plan) or _failed_check(14, "Str", $plan, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'quantity'} ? : 0 0 0
if (exists $_{"quantity"}) 0 0 0
Type::Tiny::XS::Int($quantity) or _failed_check(18, "Int", $quantity, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'source'} ? : 0 0 0
if (exists $_{"source"}) 0 0 0
exists $_{'trial_end'} ? : 0 0 0
if (exists $_{"trial_end"}) 0 0 0
Type::Tiny::XS::AUTO::TC17($trial_end) or _failed_check(81, "Int|Str", $trial_end, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
406  
407 0 my $customer_obj;
408 0 ▶ if ( ref( $customer ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) { } 0 0 0
409 0 $customer_obj = $customer;
410 } else {
411 0 my %args = (
412 account_balance => $account_balance,
413 balance => $balance,
414 card => $card,
415 coupon => $coupon,
416 default_card => $default_card,
417 default_source => $default_source,
418 email => $email,
419 metadata => $metadata,
420 plan => $plan,
421 quantity => $quantity,
422 source => $source,
423 trial_end => $trial_end,
424 );
425 0 ▶ $args{id} = $customer if defined( $customer );
Branch: 1 branch
BranchTrueFalseTotal
if defined $customer 0 0 0
426  
427 0 $customer_obj = Net::Stripe::Customer->new( %args );
428 }
429  
430 0 ▶ if ( my $customer_id = $customer_obj->id ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $customer_id = $customer_obj->id) { } 0 0 0
431 0 return $self->_post("customers/$customer_id", $customer_obj);
432 } else {
433 0 return $self->_post('customers', $customer_obj);
434 }
435 }
436  
437 method list_subscriptions(Net::Stripe::Customer|Str :$customer,
438 Str :$ending_before?,
439 Int :$limit?,
440 0 ▶ Str :$starting_after?) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine list_subscriptions: not called CC=21 SCAR=53.8
Branch: 17 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(82, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::Str($ending_before) or _failed_check(14, "Str", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::Int($limit) or _failed_check(18, "Int", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::Str($starting_after) or _failed_check(14, "Str", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
441 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
442 0 $customer = $customer->id;
443 }
444 0 my %args = (
445 path => "customers/$customer/subscriptions",
446 ending_before => $ending_before,
447 limit => $limit,
448 starting_after => $starting_after,
449 );
450 0 return $self->_get_all(%args);
451 }
452  
453 0 ▶ method get_customer(Str :$customer_id) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine get_customer: not called CC=11 SCAR=40.4
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer_id'} ? : 0 0 0
if (exists $_{"customer_id"}) 0 0 0
Type::Tiny::XS::Str($customer_id) or _failed_check(14, "Str", $customer_id, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
454 0 return $self->_get("customers/$customer_id");
455 }
456  
457 0 ▶ method delete_customer(Net::Stripe::Customer|Str :$customer) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine delete_customer: not called CC=12 SCAR=42.6
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(83, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
458 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
459 0 $customer = $customer->id;
460 }
461 0 $self->_delete("customers/$customer");
462 }
463  
464 0 ▶ method get_customers(HashRef :$created?, Str :$ending_before?, Int :$limit?, Str :$starting_after?, Str :$email?) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine get_customers: not called CC=23 SCAR=55.3
Branch: 20 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'created'} ? : 0 0 0
if (exists $_{"created"}) 0 0 0
Ref::Util::XS::is_plain_hashref($created) or _failed_check(27, "HashRef", $created, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::Str($ending_before) or _failed_check(14, "Str", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::Int($limit) or _failed_check(18, "Int", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::Str($starting_after) or _failed_check(14, "Str", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'email'} ? : 0 0 0
if (exists $_{"email"}) 0 0 0
Type::Tiny::XS::Str($email) or _failed_check(14, "Str", $email, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
465 0 my %args = (
466 path => 'customers',
467 created => $created,
468 ending_before => $ending_before,
469 limit => $limit,
470 starting_after => $starting_after,
471 email => $email,
472 );
473 0 $self->_get_all(%args);
474 }
475 }
476  
477  
478 2 Cards: {
479 method get_card(Net::Stripe::Customer|Str :$customer,
480 0 ▶ Str :$card_id) {
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine get_card: not called CC=15 SCAR=47.0
Branch: 11 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(84, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'card_id'} ? : 0 0 0
if (exists $_{"card_id"}) 0 0 0
Type::Tiny::XS::Str($card_id) or _failed_check(14, "Str", $card_id, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
481 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
482 0 $customer = $customer->id;
483 }
484 0 return $self->_get("customers/$customer/sources/$card_id");
485 }
486  
487 method get_cards(Net::Stripe::Customer|Str :$customer,
488 HashRef :$created?,
489 Str :$ending_before?,
490 Int :$limit?,
491 0 ▶ Str :$starting_after?) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine get_cards: not called CC=24 SCAR=56.4
Branch: 20 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(85, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'created'} ? : 0 0 0
if (exists $_{"created"}) 0 0 0
Ref::Util::XS::is_plain_hashref($created) or _failed_check(27, "HashRef", $created, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::Str($ending_before) or _failed_check(14, "Str", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::Int($limit) or _failed_check(18, "Int", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::Str($starting_after) or _failed_check(14, "Str", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
492 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
493 0 $customer = $customer->id;
494 }
495  
496 0 my %args = (
497 path => "customers/$customer/sources",
498 object => "card",
499 created => $created,
500 ending_before => $ending_before,
501 limit => $limit,
502 starting_after => $starting_after,
503 );
504 0 $self->_get_all(%args);
505 }
506  
507 method post_card(
508 Net::Stripe::Customer|StripeCustomerId :$customer!,
509 Net::Stripe::Token|StripeTokenId :$card?,
510 StripeTokenId :$source?,
511 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine post_card: not called CC=20 SCAR=55.7
Branch: 11 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
exists $_{'card'} ? : 0 0 0
if (exists $_{"card"}) 0 0 0
exists $_{'source'} ? : 0 0 0
if (exists $_{"source"}) 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
512  
513 0 ▶ die Net::Stripe::Error->new(
Branch: 1 branch
BranchTrueFalseTotal
unless defined $card or defined $source 0 0 0
Condition0%0/3
defined $card or defined $source
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $card or defined $source
defined $card defined $source
Truth table0%0/3
A or B
A= defined $cardB= defined $source
ABresult
1X1
011
000
514 type => "post_card error",
515 message => "One of parameters 'source' or 'card' is required.",
516 ) unless defined( $card ) || defined( $source );
517  
518 0 ▶ my $customer_id = ref( $customer ) ? $customer->id : $customer;
Branch: 1 branch
BranchTrueFalseTotal
ref $customer ? : 0 0 0
519  
520 0 ▶ if ( defined( $card ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $card) 0 0 0
521 # card here is either Net::Stripe::Token or StripeTokenId
522 0 ▶ my $token_id = ref( $card ) ? $card->id : $card;
Branch: 1 branch
BranchTrueFalseTotal
ref $card ? : 0 0 0
523 0 return $self->_post("customers/$customer_id/cards", {card=> $token_id});
524 }
525  
526 0 ▶ if ( defined( $source ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $source) 0 0 0
527 0 return $self->_post("customers/$customer_id/cards", { source=> $source });
528 }
529 }
530  
531 method update_card(StripeCustomerId :$customer_id!,
532 StripeCardId :$card_id!,
533 0 ▶ HashRef :$card!) {
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine update_card: not called CC=15 SCAR=47.9
Branch: 12 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer_id'} ? : 0 0 0
if (exists $_{"customer_id"}) 0 0 0
exists $_{'card_id'} ? : 0 0 0
if (exists $_{"card_id"}) 0 0 0
exists $_{'card'} ? : 0 0 0
if (exists $_{"card"}) 0 0 0
Ref::Util::XS::is_plain_hashref($card) or _failed_check(27, "HashRef", $card, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
534 0 return $self->_post("customers/$customer_id/cards/$card_id", $card);
535 }
536  
537 0 ▶ method delete_card(Net::Stripe::Customer|Str :$customer, Net::Stripe::Card|Str :$card) {
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine delete_card: not called CC=16 SCAR=48.6
Branch: 11 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(88, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'card'} ? : 0 0 0
if (exists $_{"card"}) 0 0 0
Type::Tiny::XS::AUTO::TC19($card) or _failed_check(91, "InstanceOf[\"Net::Stripe::Card\"]|Str", $card, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
538 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
539 0 $customer = $customer->id;
540 }
541  
542 0 ▶ if (ref($card)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $card) 0 0 0
543 0 $card = $card->id;
544 }
545  
546 0 return $self->_delete("customers/$customer/sources/$card");
547 }
548 }
549  
550  
551 2 Sources: {
552 method create_source(
553 StripeSourceType :$type!,
554 Int :$amount?,
555 Str :$currency?,
556 StripeSourceFlow :$flow?,
557 HashRef :$mandate?,
558 HashRef :$metadata?,
559 HashRef :$owner?,
560 HashRef :$receiver?,
561 HashRef :$redirect?,
562 HashRef :$source_order?,
563 Str :$statement_descriptor?,
564 StripeTokenId :$token?,
565 StripeSourceUsage :$usage?,
566 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine create_source: not called CC=49 SCAR=71.1
Branch: 43 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'type'} ? : 0 0 0
if (exists $_{"type"}) 0 0 0
Type::Tiny::XS::AUTO::TC20($type) or _failed_check(92, "StripeSourceType", $type, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'amount'} ? : 0 0 0
if (exists $_{"amount"}) 0 0 0
Type::Tiny::XS::Int($amount) or _failed_check(18, "Int", $amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'currency'} ? : 0 0 0
if (exists $_{"currency"}) 0 0 0
Type::Tiny::XS::Str($currency) or _failed_check(14, "Str", $currency, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'flow'} ? : 0 0 0
if (exists $_{"flow"}) 0 0 0
Type::Tiny::XS::AUTO::TC21($flow) or _failed_check(93, "StripeSourceFlow", $flow, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'mandate'} ? : 0 0 0
if (exists $_{"mandate"}) 0 0 0
Ref::Util::XS::is_plain_hashref($mandate) or _failed_check(27, "HashRef", $mandate, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
Ref::Util::XS::is_plain_hashref($metadata) or _failed_check(27, "HashRef", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'owner'} ? : 0 0 0
if (exists $_{"owner"}) 0 0 0
Ref::Util::XS::is_plain_hashref($owner) or _failed_check(27, "HashRef", $owner, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'receiver'} ? : 0 0 0
if (exists $_{"receiver"}) 0 0 0
Ref::Util::XS::is_plain_hashref($receiver) or _failed_check(27, "HashRef", $receiver, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'redirect'} ? : 0 0 0
if (exists $_{"redirect"}) 0 0 0
Ref::Util::XS::is_plain_hashref($redirect) or _failed_check(27, "HashRef", $redirect, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'source_order'} ? : 0 0 0
if (exists $_{"source_order"}) 0 0 0
Ref::Util::XS::is_plain_hashref($source_order) or _failed_check(27, "HashRef", $source_order, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'statement_descriptor'} ? : 0 0 0
if (exists $_{"statement_descriptor"}) 0 0 0
Type::Tiny::XS::Str($statement_descriptor) or _failed_check(14, "Str", $statement_descriptor, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'token'} ? : 0 0 0
if (exists $_{"token"}) 0 0 0
exists $_{'usage'} ? : 0 0 0
if (exists $_{"usage"}) 0 0 0
Type::Tiny::XS::AUTO::TC22($usage) or _failed_check(94, "StripeSourceUsage", $usage, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
567  
568 0 ▶ die Net::Stripe::Error->new(
Branch: 1 branch
BranchTrueFalseTotal
if defined $type and $type eq "card" and not defined $token 0 0 0
Condition0%0/6
defined $type and $type eq "card" and not defined $token
!ll&&!rl&&r
000
defined $type and $type eq "card"
!ll&&!rl&&r
000
MC/DC0%0/3
defined $type and $type eq "card" and not defined $token
defined $type $type eq "card" not defined $token
Truth table0%0/4
A and B and not(C)
A= defined $typeB= $type eq "card"C= not defined $token
ABCresult
0XX0
10X0
1100
1111
569 type => "create_source error",
570 message => "Parameter 'token' is required for source type 'card'",
571 param => 'token',
572 ) if defined( $type ) && $type eq 'card' && ! defined( $token );
573  
574 0 my %args = (
575 amount => $amount,
576 currency => $currency,
577 flow => $flow,
578 mandate => $mandate,
579 metadata => $metadata,
580 owner => $owner,
581 receiver => $receiver,
582 redirect => $redirect,
583 source_order => $source_order,
584 statement_descriptor => $statement_descriptor,
585 token => $token,
586 type => $type,
587 usage => $usage,
588 );
589 0 my $source_obj = Net::Stripe::Source->new( %args );
590 0 return $self->_post("sources", $source_obj);
591 }
592  
593 method get_source(
594 StripeSourceId :$source_id!,
595 Str :$client_secret?,
596 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine get_source: not called CC=13 SCAR=44.6
Branch: 10 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'source_id'} ? : 0 0 0
if (exists $_{"source_id"}) 0 0 0
exists $_{'client_secret'} ? : 0 0 0
if (exists $_{"client_secret"}) 0 0 0
Type::Tiny::XS::Str($client_secret) or _failed_check(14, "Str", $client_secret, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
597 0 my %args = (
598 client_secret => $client_secret,
599 );
600 0 return $self->_get("sources/$source_id", \%args);
601 }
602  
603 method update_source(
604 StripeSourceId :$source_id!,
605 Int :$amount?,
606 HashRef :$mandate?,
607 HashRef|EmptyStr :$metadata?,
608 HashRef :$owner?,
609 HashRef :$source_order?,
610 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine update_source: not called CC=25 SCAR=58.3
Branch: 21 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'source_id'} ? : 0 0 0
if (exists $_{"source_id"}) 0 0 0
exists $_{'amount'} ? : 0 0 0
if (exists $_{"amount"}) 0 0 0
Type::Tiny::XS::Int($amount) or _failed_check(18, "Int", $amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'mandate'} ? : 0 0 0
if (exists $_{"mandate"}) 0 0 0
Ref::Util::XS::is_plain_hashref($mandate) or _failed_check(27, "HashRef", $mandate, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
exists $_{'owner'} ? : 0 0 0
if (exists $_{"owner"}) 0 0 0
Ref::Util::XS::is_plain_hashref($owner) or _failed_check(27, "HashRef", $owner, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'source_order'} ? : 0 0 0
if (exists $_{"source_order"}) 0 0 0
Ref::Util::XS::is_plain_hashref($source_order) or _failed_check(27, "HashRef", $source_order, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
611 0 my %args = (
612 amount => $amount,
613 mandate => $mandate,
614 metadata => $metadata,
615 owner => $owner,
616 source_order => $source_order,
617 );
618 0 my $source_obj = Net::Stripe::Source->new( %args );
619  
620 0 my @one_of = qw/ amount mandate metadata owner source_order /;
621 0 my @defined = grep { defined( $source_obj->$_ ) } @one_of;
622  
623 0 ▶ die Net::Stripe::Error->new(
Branch: 1 branch
BranchTrueFalseTotal
unless @defined 0 0 0
624 type => "update_source error",
625 message => sprintf( "at least one of: %s is required to update a source",
626 join( ', ', @one_of ),
627 ),
628 ) if ! @defined;
629  
630 0 return $self->_post("sources/$source_id", $source_obj);
631 }
632  
633 method attach_source (
634 StripeCustomerId :$customer_id!,
635 StripeSourceId :$source_id!,
636 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine attach_source: not called CC=12 SCAR=43.9
Branch: 9 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer_id'} ? : 0 0 0
if (exists $_{"customer_id"}) 0 0 0
exists $_{'source_id'} ? : 0 0 0
if (exists $_{"source_id"}) 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
637 0 my %args = (
638 source => $source_id,
639 );
640 0 return $self->_post("customers/$customer_id/sources", \%args);
641 }
642  
643 method detach_source(
644 StripeCustomerId :$customer_id!,
645 StripeSourceId :$source_id!,
646 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine detach_source: not called CC=12 SCAR=43.7
Branch: 9 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer_id'} ? : 0 0 0
if (exists $_{"customer_id"}) 0 0 0
exists $_{'source_id'} ? : 0 0 0
if (exists $_{"source_id"}) 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
647 0 return $self->_delete("customers/$customer_id/sources/$source_id");
648 }
649  
650 # undocumented API endpoint
651 method list_sources(
652 StripeCustomerId :$customer_id!,
653 Str :$object!,
654 Str :$ending_before?,
655 Int :$limit?,
656 Str :$starting_after?,
657 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine list_sources: not called CC=22 SCAR=54.9
Branch: 19 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer_id'} ? : 0 0 0
if (exists $_{"customer_id"}) 0 0 0
exists $_{'object'} ? : 0 0 0
if (exists $_{"object"}) 0 0 0
Type::Tiny::XS::Str($object) or _failed_check(14, "Str", $object, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::Str($ending_before) or _failed_check(14, "Str", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::Int($limit) or _failed_check(18, "Int", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::Str($starting_after) or _failed_check(14, "Str", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
658 0 my %args = (
659 ending_before => $ending_before,
660 limit => $limit,
661 object => $object,
662 starting_after => $starting_after,
663 );
664 0 return $self->_get("customers/$customer_id/sources", \%args);
665 }
666 }
667  
668  
669 2 Subscriptions: {
670 0 ▶ method get_subscription(Net::Stripe::Customer|Str :$customer) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine get_subscription: not called CC=12 SCAR=42.6
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(96, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
671 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
672 0 $customer = $customer->id;
673 }
674 0 return $self->_get("customers/$customer/subscription");
675 }
676  
677 # adds a subscription, keeping any existing subscriptions unmodified
678 method post_subscription(Net::Stripe::Customer|Str :$customer,
679 Net::Stripe::Subscription|Str :$subscription?,
680 Net::Stripe::Plan|Str :$plan?,
681 Str :$coupon?,
682 Int|Str :$trial_end?,
683 Net::Stripe::Card|Net::Stripe::Token|Str :$card?,
684 Net::Stripe::Card|Net::Stripe::Token|Str :$source?,
685 Int :$quantity? where { $_ >= 0 },
686 Num :$application_fee_percent?,
687 Bool :$prorate? = 1,
688 Bool :$cancel_at_period_end?,
689 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine post_subscription: not called CC=48 SCAR=71.0
Branch: 38 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(97, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'subscription'} ? : 0 0 0
if (exists $_{"subscription"}) 0 0 0
Type::Tiny::XS::AUTO::TC24($subscription) or _failed_check(101, "InstanceOf[\"Net::Stripe::Subscription\"]|Str", $subscription, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'plan'} ? : 0 0 0
if (exists $_{"plan"}) 0 0 0
Type::Tiny::XS::AUTO::TC26($plan) or _failed_check(105, "InstanceOf[\"Net::Stripe::Plan\"]|Str", $plan, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'coupon'} ? : 0 0 0
if (exists $_{"coupon"}) 0 0 0
Type::Tiny::XS::Str($coupon) or _failed_check(14, "Str", $coupon, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'trial_end'} ? : 0 0 0
if (exists $_{"trial_end"}) 0 0 0
Type::Tiny::XS::AUTO::TC17($trial_end) or _failed_check(106, "Int|Str", $trial_end, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'card'} ? : 0 0 0
if (exists $_{"card"}) 0 0 0
Type::Tiny::XS::AUTO::TC27($card) or _failed_check(107, "InstanceOf[\"Net::Stripe::Card\"]|InstanceOf[\"Net::Stripe::Token\"]|Str", $card, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'source'} ? : 0 0 0
if (exists $_{"source"}) 0 0 0
Type::Tiny::XS::AUTO::TC27($source) or _failed_check(108, "InstanceOf[\"Net::Stripe::Card\"]|InstanceOf[\"Net::Stripe::Token\"]|Str", $source, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'quantity'} ? : 0 0 0
if (exists $_{"quantity"}) 0 0 0
Type::Tiny::XS::Int($quantity) or _failed_check(18, "Int", $quantity, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
do { local $_ = $quantity; $Kavorka::Parameter::PARAMS[242]{"constraints"}[0]->() } or Carp::croak("\$quantity failed value constraint") 0 0 0
exists $_{'application_fee_percent'} ? : 0 0 0
if (exists $_{"application_fee_percent"}) 0 0 0
defined $application_fee_percent and not ref $application_fee_percent and &Scalar::Util::looks_like_number($application_fee_percent) or _failed_check(17, "Num", $application_fee_percent, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'prorate'} ? : 0 0 0
Type::Tiny::XS::Bool($prorate) or _failed_check(10, "Bool", $prorate, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'cancel_at_period_end'} ? : 0 0 0
if (exists $_{"cancel_at_period_end"}) 0 0 0
Type::Tiny::XS::Bool($cancel_at_period_end) or _failed_check(10, "Bool", $cancel_at_period_end, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/9
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
defined $application_fee_percent and not ref $application_fee_percent and &Scalar::Util::looks_like_number($application_fee_percent)
!ll&&!rl&&r
000
defined $application_fee_percent and not ref $application_fee_percent
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/3
defined $application_fee_percent and not ref $application_fee_percent and &Scalar::Util::looks_like_number($application_fee_percent)
defined $application_fee_percent not ref $application_fee_percent &Scalar::Util::looks_like_number($application_fee_percent)
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $application_fee_percentB= not ref $application_fee_percentC= &Scalar::Util::looks_like_number($application_fee_percent)
ABCresult
0XX0
10X0
1100
1111
690 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
691 0 $customer = $customer->id;
692 }
693  
694 0 ▶ if (ref($plan)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $plan) 0 0 0
695 0 $plan = $plan->id;
696 }
697  
698 0 ▶ if (ref($subscription) ne 'Net::Stripe::Subscription') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $subscription ne "Net::Stripe::Subscription") 0 0 0
699 0 my %args = (plan => $plan,
700 coupon => $coupon,
701 trial_end => $trial_end,
702 card => $card,
703 source => $source,
704 prorate => $prorate,
705 quantity => $quantity,
706 application_fee_percent => $application_fee_percent,
707 cancel_at_period_end => $cancel_at_period_end);
708 0 ▶ if (defined($subscription)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $subscription) 0 0 0
709 0 $args{id} = $subscription;
710 }
711 0 $subscription = Net::Stripe::Subscription->new( %args );
712 }
713  
714 0 ▶ if (defined($subscription->id)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $subscription->id) { } 0 0 0
715 0 return $self->_post("customers/$customer/subscriptions/" . $subscription->id, $subscription);
716 } else {
717 0 return $self->_post("customers/$customer/subscriptions", $subscription);
718 }
719 }
720  
721 method delete_subscription(Net::Stripe::Customer|Str :$customer,
722 Net::Stripe::Subscription|Str :$subscription,
723 Bool :$at_period_end?
724 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine delete_subscription: not called CC=20 SCAR=53.3
Branch: 14 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(109, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'subscription'} ? : 0 0 0
if (exists $_{"subscription"}) 0 0 0
Type::Tiny::XS::AUTO::TC24($subscription) or _failed_check(110, "InstanceOf[\"Net::Stripe::Subscription\"]|Str", $subscription, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'at_period_end'} ? : 0 0 0
if (exists $_{"at_period_end"}) 0 0 0
Type::Tiny::XS::Bool($at_period_end) or _failed_check(10, "Bool", $at_period_end, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
725 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
726 0 $customer = $customer->id;
727 }
728 0 ▶ if (ref($subscription)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $subscription) 0 0 0
729 0 $subscription = $subscription->id;
730 }
731  
732 0 my %args;
733 0 ▶ $args{at_period_end} = 'true' if $at_period_end;
Branch: 1 branch
BranchTrueFalseTotal
if $at_period_end 0 0 0
734 0 return $self->_delete("customers/$customer/subscriptions/$subscription", \%args);
735 }
736 }
737  
738  
739 2 PaymentMethods: {
740 method create_payment_method(
741 StripePaymentMethodType :$type!,
742 HashRef :$billing_details?,
743 StripeTokenId :$card?,
744 HashRef :$fpx?,
745 HashRef :$ideal?,
746 HashRef[Str] :$metadata?,
747 StripePaymentMethodId :$payment_method?,
748 HashRef :$sepa_debit?,
749 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine create_payment_method: not called CC=30 SCAR=61.4
Branch: 27 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'type'} ? : 0 0 0
if (exists $_{"type"}) 0 0 0
Type::Tiny::XS::AUTO::TC12($type) or _failed_check(67, "StripePaymentMethodType", $type, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'billing_details'} ? : 0 0 0
if (exists $_{"billing_details"}) 0 0 0
Ref::Util::XS::is_plain_hashref($billing_details) or _failed_check(27, "HashRef", $billing_details, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'card'} ? : 0 0 0
if (exists $_{"card"}) 0 0 0
exists $_{'fpx'} ? : 0 0 0
if (exists $_{"fpx"}) 0 0 0
Ref::Util::XS::is_plain_hashref($fpx) or _failed_check(27, "HashRef", $fpx, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ideal'} ? : 0 0 0
if (exists $_{"ideal"}) 0 0 0
Ref::Util::XS::is_plain_hashref($ideal) or _failed_check(27, "HashRef", $ideal, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
Type::Tiny::XS::AUTO::TC11($metadata) or _failed_check(65, "HashRef[Str]", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'payment_method'} ? : 0 0 0
if (exists $_{"payment_method"}) 0 0 0
exists $_{'sepa_debit'} ? : 0 0 0
if (exists $_{"sepa_debit"}) 0 0 0
Ref::Util::XS::is_plain_hashref($sepa_debit) or _failed_check(27, "HashRef", $sepa_debit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
750 0 my %args = (
751 type => $type,
752 billing_details => $billing_details,
753 card => $card,
754 fpx => $fpx,
755 ideal => $ideal,
756 metadata => $metadata,
757 payment_method => $payment_method,
758 sepa_debit => $sepa_debit,
759 );
760 0 my $payment_method_obj = Net::Stripe::PaymentMethod->new( %args );
761 0 return $self->_post("payment_methods", $payment_method_obj);
762 }
763  
764 method get_payment_method(
765 StripePaymentMethodId :$payment_method_id!,
766 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine get_payment_method: not called CC=10 SCAR=39.4
Branch: 7 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'payment_method_id'} ? : 0 0 0
if (exists $_{"payment_method_id"}) 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
767 0 return $self->_get("payment_methods/$payment_method_id");
768 }
769  
770 method update_payment_method(
771 StripePaymentMethodId :$payment_method_id!,
772 HashRef :$billing_details?,
773 HashRef[Int] :$card?,
774 HashRef[Str]|EmptyStr :$metadata?,
775 HashRef :$sepa_debit?,
776 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine update_payment_method: not called CC=21 SCAR=54.5
Branch: 18 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'payment_method_id'} ? : 0 0 0
if (exists $_{"payment_method_id"}) 0 0 0
exists $_{'billing_details'} ? : 0 0 0
if (exists $_{"billing_details"}) 0 0 0
Ref::Util::XS::is_plain_hashref($billing_details) or _failed_check(27, "HashRef", $billing_details, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'card'} ? : 0 0 0
if (exists $_{"card"}) 0 0 0
Type::Tiny::XS::AUTO::TC15($card) or _failed_check(73, "HashRef[Int]", $card, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
exists $_{'sepa_debit'} ? : 0 0 0
if (exists $_{"sepa_debit"}) 0 0 0
Ref::Util::XS::is_plain_hashref($sepa_debit) or _failed_check(27, "HashRef", $sepa_debit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
777 0 my %args = (
778 billing_details => $billing_details,
779 card => $card,
780 metadata => $metadata,
781 sepa_debit => $sepa_debit,
782 );
783 0 my $payment_method_obj = Net::Stripe::PaymentMethod->new( %args );
784 0 return $self->_post("payment_methods/$payment_method_id", $payment_method_obj);
785 }
786  
787 method list_payment_methods(
788 StripeCustomerId :$customer!,
789 StripePaymentMethodType :$type!,
790 Str :$ending_before?,
791 Int :$limit?,
792 Str :$starting_after?,
793 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine list_payment_methods: not called CC=22 SCAR=54.9
Branch: 19 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
exists $_{'type'} ? : 0 0 0
if (exists $_{"type"}) 0 0 0
Type::Tiny::XS::AUTO::TC12($type) or _failed_check(67, "StripePaymentMethodType", $type, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::Str($ending_before) or _failed_check(14, "Str", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::Int($limit) or _failed_check(18, "Int", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::Str($starting_after) or _failed_check(14, "Str", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
794 0 my %args = (
795 customer => $customer,
796 type => $type,
797 ending_before => $ending_before,
798 limit => $limit,
799 starting_after => $starting_after,
800 );
801 0 return $self->_get("payment_methods", \%args);
802 }
803  
804 method attach_payment_method(
805 StripeCustomerId :$customer!,
806 StripePaymentMethodId :$payment_method_id!,
807 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine attach_payment_method: not called CC=12 SCAR=43.9
Branch: 9 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
exists $_{'payment_method_id'} ? : 0 0 0
if (exists $_{"payment_method_id"}) 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
808 0 my %args = (
809 customer => $customer,
810 );
811 0 return $self->_post("payment_methods/$payment_method_id/attach", \%args);
812 }
813  
814 method detach_payment_method(
815 StripePaymentMethodId :$payment_method_id!,
816 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine detach_payment_method: not called CC=10 SCAR=39.4
Branch: 7 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'payment_method_id'} ? : 0 0 0
if (exists $_{"payment_method_id"}) 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
817 0 return $self->_post("payment_methods/$payment_method_id/detach");
818 }
819 }
820  
821  
822 2 Tokens: {
823 0 ▶ method get_token(Str :$token_id) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine get_token: not called CC=11 SCAR=40.4
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'token_id'} ? : 0 0 0
if (exists $_{"token_id"}) 0 0 0
Type::Tiny::XS::Str($token_id) or _failed_check(14, "Str", $token_id, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
824 0 return $self->_get("tokens/$token_id");
825 }
826 }
827  
828  
829 2 Products: {
830 method create_product(
831 Str :$name!,
832 Bool :$active?,
833 ArrayRef[Str] :$attributes?,
834 Str :$caption?,
835 ArrayRef[Str] :$deactivate_on?,
836 Str :$description?,
837 StripeProductId|Str :$id?,
838 ArrayRef[Str] :$images?,
839 HashRef[Str] :$metadata?,
840 HashRef[Num] :$package_dimensions?,
841 Bool :$shippable?,
842 Str :$statement_descriptor?,
843 StripeProductType :$type?,
844 Str :$unit_label?,
845 Str :$url?,
846 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine create_product: not called CC=57 SCAR=74.3
Branch: 50 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'name'} ? : 0 0 0
if (exists $_{"name"}) 0 0 0
Type::Tiny::XS::Str($name) or _failed_check(14, "Str", $name, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'active'} ? : 0 0 0
if (exists $_{"active"}) 0 0 0
Type::Tiny::XS::Bool($active) or _failed_check(10, "Bool", $active, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'attributes'} ? : 0 0 0
if (exists $_{"attributes"}) 0 0 0
Type::Tiny::XS::AUTO::TC28($attributes) or _failed_check(112, "ArrayRef[Str]", $attributes, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'caption'} ? : 0 0 0
if (exists $_{"caption"}) 0 0 0
Type::Tiny::XS::Str($caption) or _failed_check(14, "Str", $caption, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'deactivate_on'} ? : 0 0 0
if (exists $_{"deactivate_on"}) 0 0 0
Type::Tiny::XS::AUTO::TC28($deactivate_on) or _failed_check(112, "ArrayRef[Str]", $deactivate_on, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'description'} ? : 0 0 0
if (exists $_{"description"}) 0 0 0
Type::Tiny::XS::Str($description) or _failed_check(14, "Str", $description, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'id'} ? : 0 0 0
if (exists $_{"id"}) 0 0 0
exists $_{'images'} ? : 0 0 0
if (exists $_{"images"}) 0 0 0
Type::Tiny::XS::AUTO::TC28($images) or _failed_check(112, "ArrayRef[Str]", $images, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
Type::Tiny::XS::AUTO::TC11($metadata) or _failed_check(65, "HashRef[Str]", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'package_dimensions'} ? : 0 0 0
if (exists $_{"package_dimensions"}) 0 0 0
do { Ref::Util::XS::is_plain_hashref($package_dimensions) and do { my $ok = 1; foreach my $i (values %{$package_dimensions;}) { $ok = 0, last unless defined $i and not ref $i and &Scalar::Util::looks_like_number($i); } ; $ok } } or _failed_check(115, "HashRef[Num]", $package_dimensions, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
unless defined $i and not ref $i and &Scalar::Util::looks_like_number($i) 0 0 0
exists $_{'shippable'} ? : 0 0 0
if (exists $_{"shippable"}) 0 0 0
Type::Tiny::XS::Bool($shippable) or _failed_check(10, "Bool", $shippable, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'statement_descriptor'} ? : 0 0 0
if (exists $_{"statement_descriptor"}) 0 0 0
Type::Tiny::XS::Str($statement_descriptor) or _failed_check(14, "Str", $statement_descriptor, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'type'} ? : 0 0 0
if (exists $_{"type"}) 0 0 0
Type::Tiny::XS::AUTO::TC29($type) or _failed_check(116, "StripeProductType", $type, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'unit_label'} ? : 0 0 0
if (exists $_{"unit_label"}) 0 0 0
Type::Tiny::XS::Str($unit_label) or _failed_check(14, "Str", $unit_label, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'url'} ? : 0 0 0
if (exists $_{"url"}) 0 0 0
Type::Tiny::XS::Str($url) or _failed_check(14, "Str", $url, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/12
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($package_dimensions) && do { my $ok = 1; foreach my $i (values %{$package_dimensions;}) { $ok = 0, last unless defined $i and not ref $i and &Scalar::Util::looks_like_number($i); } ; $ok }
!ll&&!rl&&r
000
defined $i and not ref $i and &Scalar::Util::looks_like_number($i)
!ll&&!rl&&r
000
defined $i and not ref $i
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/2
Ref::Util::XS::is_plain_hashref($package_dimensions) && do { my $ok = 1; foreach my $i (values %{$package_dimensions;}) { $ok = 0, last unless defined $i and not ref $i and &Scalar::Util::looks_like_number($i); } ; $ok }
Ref::Util::XS::is_plain_hashref($package_dimensions) do { my $ok = 1; foreach my $i (values %{$package_dimensions;}) { $ok = 0, last unless defined $i and not ref $i and &Scalar::Util::looks_like_number($i); } ; $ok }
MC/DC0%0/3
defined $i and not ref $i and &Scalar::Util::looks_like_number($i)
defined $i not ref $i &Scalar::Util::looks_like_number($i)
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/3
A && B
A= Ref::Util::XS::is_plain_hashref($package_dimensions)B= do { my $ok = 1; foreach my $i (values %{$package_dimensions;}) { $ok = 0, last unless defined $i and not ref $i and &Scalar::Util::looks_like_number($i); } ; $ok }
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $iB= not ref $iC= &Scalar::Util::looks_like_number($i)
ABCresult
0XX0
10X0
1100
1111
847 0 my %args = (
848 name => $name,
849 active => $active,
850 attributes => $attributes,
851 caption => $caption,
852 deactivate_on => $deactivate_on,
853 description => $description,
854 id => $id,
855 images => $images,
856 metadata => $metadata,
857 package_dimensions => $package_dimensions,
858 shippable => $shippable,
859 statement_descriptor => $statement_descriptor,
860 type => $type,
861 unit_label => $unit_label,
862 url => $url,
863 );
864 0 my $product_obj = Net::Stripe::Product->new( %args );
865 0 return $self->_post('products', $product_obj);
866 }
867  
868 method get_product(
869 StripeProductId|Str :$product_id!,
870 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine get_product: not called CC=10 SCAR=39.4
Branch: 7 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'product_id'} ? : 0 0 0
if (exists $_{"product_id"}) 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
871 0 return $self->_get("products/$product_id");
872 }
873  
874 method update_product(
875 StripeProductId|Str :$product_id!,
876 Bool :$active?,
877 ArrayRef[Str] :$attributes?,
878 Str :$caption?,
879 ArrayRef[Str] :$deactivate_on?,
880 Str :$description?,
881 ArrayRef[Str] :$images?,
882 HashRef[Str]|EmptyStr :$metadata?,
883 Str :$name?,
884 HashRef[Num] :$package_dimensions?,
885 Bool :$shippable?,
886 Str :$statement_descriptor?,
887 StripeProductType :$type?,
888 Str :$unit_label?,
889 Str :$url?,
890 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine update_product: not called CC=56 SCAR=74.1
Branch: 49 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'product_id'} ? : 0 0 0
if (exists $_{"product_id"}) 0 0 0
exists $_{'active'} ? : 0 0 0
if (exists $_{"active"}) 0 0 0
Type::Tiny::XS::Bool($active) or _failed_check(10, "Bool", $active, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'attributes'} ? : 0 0 0
if (exists $_{"attributes"}) 0 0 0
Type::Tiny::XS::AUTO::TC28($attributes) or _failed_check(112, "ArrayRef[Str]", $attributes, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'caption'} ? : 0 0 0
if (exists $_{"caption"}) 0 0 0
Type::Tiny::XS::Str($caption) or _failed_check(14, "Str", $caption, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'deactivate_on'} ? : 0 0 0
if (exists $_{"deactivate_on"}) 0 0 0
Type::Tiny::XS::AUTO::TC28($deactivate_on) or _failed_check(112, "ArrayRef[Str]", $deactivate_on, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'description'} ? : 0 0 0
if (exists $_{"description"}) 0 0 0
Type::Tiny::XS::Str($description) or _failed_check(14, "Str", $description, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'images'} ? : 0 0 0
if (exists $_{"images"}) 0 0 0
Type::Tiny::XS::AUTO::TC28($images) or _failed_check(112, "ArrayRef[Str]", $images, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
exists $_{'name'} ? : 0 0 0
if (exists $_{"name"}) 0 0 0
Type::Tiny::XS::Str($name) or _failed_check(14, "Str", $name, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'package_dimensions'} ? : 0 0 0
if (exists $_{"package_dimensions"}) 0 0 0
do { Ref::Util::XS::is_plain_hashref($package_dimensions) and do { my $ok = 1; foreach my $i (values %{$package_dimensions;}) { $ok = 0, last unless defined $i and not ref $i and &Scalar::Util::looks_like_number($i); } ; $ok } } or _failed_check(115, "HashRef[Num]", $package_dimensions, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
unless defined $i and not ref $i and &Scalar::Util::looks_like_number($i) 0 0 0
exists $_{'shippable'} ? : 0 0 0
if (exists $_{"shippable"}) 0 0 0
Type::Tiny::XS::Bool($shippable) or _failed_check(10, "Bool", $shippable, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'statement_descriptor'} ? : 0 0 0
if (exists $_{"statement_descriptor"}) 0 0 0
Type::Tiny::XS::Str($statement_descriptor) or _failed_check(14, "Str", $statement_descriptor, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'type'} ? : 0 0 0
if (exists $_{"type"}) 0 0 0
Type::Tiny::XS::AUTO::TC29($type) or _failed_check(116, "StripeProductType", $type, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'unit_label'} ? : 0 0 0
if (exists $_{"unit_label"}) 0 0 0
Type::Tiny::XS::Str($unit_label) or _failed_check(14, "Str", $unit_label, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'url'} ? : 0 0 0
if (exists $_{"url"}) 0 0 0
Type::Tiny::XS::Str($url) or _failed_check(14, "Str", $url, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/12
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($package_dimensions) && do { my $ok = 1; foreach my $i (values %{$package_dimensions;}) { $ok = 0, last unless defined $i and not ref $i and &Scalar::Util::looks_like_number($i); } ; $ok }
!ll&&!rl&&r
000
defined $i and not ref $i and &Scalar::Util::looks_like_number($i)
!ll&&!rl&&r
000
defined $i and not ref $i
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/2
Ref::Util::XS::is_plain_hashref($package_dimensions) && do { my $ok = 1; foreach my $i (values %{$package_dimensions;}) { $ok = 0, last unless defined $i and not ref $i and &Scalar::Util::looks_like_number($i); } ; $ok }
Ref::Util::XS::is_plain_hashref($package_dimensions) do { my $ok = 1; foreach my $i (values %{$package_dimensions;}) { $ok = 0, last unless defined $i and not ref $i and &Scalar::Util::looks_like_number($i); } ; $ok }
MC/DC0%0/3
defined $i and not ref $i and &Scalar::Util::looks_like_number($i)
defined $i not ref $i &Scalar::Util::looks_like_number($i)
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/3
A && B
A= Ref::Util::XS::is_plain_hashref($package_dimensions)B= do { my $ok = 1; foreach my $i (values %{$package_dimensions;}) { $ok = 0, last unless defined $i and not ref $i and &Scalar::Util::looks_like_number($i); } ; $ok }
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $iB= not ref $iC= &Scalar::Util::looks_like_number($i)
ABCresult
0XX0
10X0
1100
1111
891 0 my %args = (
892 active => $active,
893 attributes => $attributes,
894 caption => $caption,
895 deactivate_on => $deactivate_on,
896 description => $description,
897 images => $images,
898 metadata => $metadata,
899 name => $name,
900 package_dimensions => $package_dimensions,
901 shippable => $shippable,
902 statement_descriptor => $statement_descriptor,
903 type => $type,
904 unit_label => $unit_label,
905 url => $url,
906 );
907 0 my $product_obj = Net::Stripe::Product->new( %args );
908 0 return $self->_post("products/$product_id", $product_obj);
909 }
910  
911 method list_products(
912 Bool :$active?,
913 ArrayRef[StripeProductId|Str] :$ids,
914 Bool :$shippable?,
915 StripeProductType :$type?,
916 Str :$url?,
917 HashRef[Str] :$created?,
918 Str :$ending_before?,
919 Int :$limit?,
920 Str :$starting_after?,
921 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine list_products: not called CC=34 SCAR=63.5
Branch: 31 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'active'} ? : 0 0 0
if (exists $_{"active"}) 0 0 0
Type::Tiny::XS::Bool($active) or _failed_check(10, "Bool", $active, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ids'} ? : 0 0 0
if (exists $_{"ids"}) 0 0 0
exists $_{'shippable'} ? : 0 0 0
if (exists $_{"shippable"}) 0 0 0
Type::Tiny::XS::Bool($shippable) or _failed_check(10, "Bool", $shippable, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'type'} ? : 0 0 0
if (exists $_{"type"}) 0 0 0
Type::Tiny::XS::AUTO::TC29($type) or _failed_check(116, "StripeProductType", $type, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'url'} ? : 0 0 0
if (exists $_{"url"}) 0 0 0
Type::Tiny::XS::Str($url) or _failed_check(14, "Str", $url, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'created'} ? : 0 0 0
if (exists $_{"created"}) 0 0 0
Type::Tiny::XS::AUTO::TC11($created) or _failed_check(65, "HashRef[Str]", $created, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::Str($ending_before) or _failed_check(14, "Str", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::Int($limit) or _failed_check(18, "Int", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::Str($starting_after) or _failed_check(14, "Str", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
922 0 my %args = (
923 path => "products",
924 active => _encode_boolean( $active ),
925 ids => $ids,
926 shippable => _encode_boolean( $shippable ),
927 type => $type,
928 url => $url,
929 created => $created,
930 ending_before => $ending_before,
931 limit => $limit,
932 starting_after => $starting_after,
933 );
934 0 return $self->_get_all( %args );
935 }
936  
937 method delete_product(
938 StripeProductId|Str :$product_id!,
939 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine delete_product: not called CC=10 SCAR=39.4
Branch: 7 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'product_id'} ? : 0 0 0
if (exists $_{"product_id"}) 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
940 0 $self->_delete("products/$product_id");
941 }
942 }
943  
944  
945 2 Plans: {
946 method post_plan(Str :$id,
947 Int :$amount,
948 Str :$currency,
949 Str :$interval,
950 Int :$interval_count?,
951 Str :$name,
952 StripeProductId|Str :$product,
953 Int :$trial_period_days?,
954 HashRef :$metadata?,
955 0 ▶ Str :$statement_descriptor?) {
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine BEGIN: called CC=1 SCAR=3.8
Subroutine post_plan: not called CC=37 SCAR=65.1
Branch: 34 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'id'} ? : 0 0 0
if (exists $_{"id"}) 0 0 0
Type::Tiny::XS::Str($id) or _failed_check(14, "Str", $id, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'amount'} ? : 0 0 0
if (exists $_{"amount"}) 0 0 0
Type::Tiny::XS::Int($amount) or _failed_check(18, "Int", $amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'currency'} ? : 0 0 0
if (exists $_{"currency"}) 0 0 0
Type::Tiny::XS::Str($currency) or _failed_check(14, "Str", $currency, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'interval'} ? : 0 0 0
if (exists $_{"interval"}) 0 0 0
Type::Tiny::XS::Str($interval) or _failed_check(14, "Str", $interval, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'interval_count'} ? : 0 0 0
if (exists $_{"interval_count"}) 0 0 0
Type::Tiny::XS::Int($interval_count) or _failed_check(18, "Int", $interval_count, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'name'} ? : 0 0 0
if (exists $_{"name"}) 0 0 0
Type::Tiny::XS::Str($name) or _failed_check(14, "Str", $name, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'product'} ? : 0 0 0
if (exists $_{"product"}) 0 0 0
exists $_{'trial_period_days'} ? : 0 0 0
if (exists $_{"trial_period_days"}) 0 0 0
Type::Tiny::XS::Int($trial_period_days) or _failed_check(18, "Int", $trial_period_days, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
Ref::Util::XS::is_plain_hashref($metadata) or _failed_check(27, "HashRef", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'statement_descriptor'} ? : 0 0 0
if (exists $_{"statement_descriptor"}) 0 0 0
Type::Tiny::XS::Str($statement_descriptor) or _failed_check(14, "Str", $statement_descriptor, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
956 0 my $plan = Net::Stripe::Plan->new(id => $id,
957 amount => $amount,
958 currency => $currency,
959 interval => $interval,
960 interval_count => $interval_count,
961 name => $name,
962 product => $product,
963 trial_period_days => $trial_period_days,
964 metadata => $metadata,
965 statement_descriptor => $statement_descriptor);
966 0 return $self->_post('plans', $plan);
967 }
968  
969 0 ▶ method get_plan(Str :$plan_id) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine get_plan: not called CC=11 SCAR=40.4
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'plan_id'} ? : 0 0 0
if (exists $_{"plan_id"}) 0 0 0
Type::Tiny::XS::Str($plan_id) or _failed_check(14, "Str", $plan_id, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
970 0 return $self->_get("plans/" . uri_escape($plan_id));
971 }
972  
973 0 ▶ method delete_plan(Str|Net::Stripe::Plan $plan) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine delete_plan: not called CC=7 SCAR=33.7
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC30($plan) or _failed_check(124, "Str|InstanceOf[\"Net::Stripe::Plan\"]", $plan, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
974 0 ▶ if (ref($plan)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $plan) 0 0 0
975 0 $plan = $plan->id;
976 }
977 0 $self->_delete("plans/$plan");
978 }
979  
980 method get_plans(
981 StripeProductId|Str :$product?,
982 Str :$ending_before?,
983 Int :$limit?,
984 Str :$starting_after?,
985 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine get_plans: not called CC=19 SCAR=52.0
Branch: 16 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'product'} ? : 0 0 0
if (exists $_{"product"}) 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::Str($ending_before) or _failed_check(14, "Str", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::Int($limit) or _failed_check(18, "Int", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::Str($starting_after) or _failed_check(14, "Str", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
986 0 my %args = (
987 path => 'plans',
988 product => $product,
989 ending_before => $ending_before,
990 limit => $limit,
991 starting_after => $starting_after,
992 );
993 0 $self->_get_all(%args);
994 }
995 }
996  
997  
998  
999 2 Coupons: {
1000 method post_coupon(Str :$id?,
1001 Str :$duration,
1002 Int :$amount_off?,
1003 Str :$currency?,
1004 Int :$duration_in_months?,
1005 Int :$max_redemptions?,
1006 HashRef :$metadata?,
1007 Int :$percent_off?,
1008 0 ▶ Int :$redeem_by?) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine post_coupon: not called CC=35 SCAR=63.7
Branch: 32 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'id'} ? : 0 0 0
if (exists $_{"id"}) 0 0 0
Type::Tiny::XS::Str($id) or _failed_check(14, "Str", $id, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'duration'} ? : 0 0 0
if (exists $_{"duration"}) 0 0 0
Type::Tiny::XS::Str($duration) or _failed_check(14, "Str", $duration, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'amount_off'} ? : 0 0 0
if (exists $_{"amount_off"}) 0 0 0
Type::Tiny::XS::Int($amount_off) or _failed_check(18, "Int", $amount_off, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'currency'} ? : 0 0 0
if (exists $_{"currency"}) 0 0 0
Type::Tiny::XS::Str($currency) or _failed_check(14, "Str", $currency, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'duration_in_months'} ? : 0 0 0
if (exists $_{"duration_in_months"}) 0 0 0
Type::Tiny::XS::Int($duration_in_months) or _failed_check(18, "Int", $duration_in_months, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'max_redemptions'} ? : 0 0 0
if (exists $_{"max_redemptions"}) 0 0 0
Type::Tiny::XS::Int($max_redemptions) or _failed_check(18, "Int", $max_redemptions, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
Ref::Util::XS::is_plain_hashref($metadata) or _failed_check(27, "HashRef", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'percent_off'} ? : 0 0 0
if (exists $_{"percent_off"}) 0 0 0
Type::Tiny::XS::Int($percent_off) or _failed_check(18, "Int", $percent_off, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'redeem_by'} ? : 0 0 0
if (exists $_{"redeem_by"}) 0 0 0
Type::Tiny::XS::Int($redeem_by) or _failed_check(18, "Int", $redeem_by, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1009 0 my $coupon = Net::Stripe::Coupon->new(id => $id,
1010 duration => $duration,
1011 amount_off => $amount_off,
1012 currency => $currency,
1013 duration_in_months => $duration_in_months,
1014 max_redemptions => $max_redemptions,
1015 metadata => $metadata,
1016 percent_off => $percent_off,
1017 redeem_by => $redeem_by
1018 );
1019 0 return $self->_post('coupons', $coupon);
1020 }
1021  
1022 0 ▶ method get_coupon(Str :$coupon_id) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine get_coupon: not called CC=11 SCAR=40.4
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'coupon_id'} ? : 0 0 0
if (exists $_{"coupon_id"}) 0 0 0
Type::Tiny::XS::Str($coupon_id) or _failed_check(14, "Str", $coupon_id, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1023 0 return $self->_get("coupons/" . uri_escape($coupon_id));
1024 }
1025  
1026 0 ▶ method delete_coupon($id) {
Subroutine BEGIN: called CC=1 SCAR=3.1
Subroutine delete_coupon: not called CC=5 SCAR=28.2
Branch: 3 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 1 0 0 0
$#_ >= 0 ? : 0 0 0
1027 0 ▶ $id = $id->id if ref($id);
Branch: 1 branch
BranchTrueFalseTotal
if ref $id 0 0 0
1028 0 $self->_delete("coupons/$id");
1029 }
1030  
1031 0 ▶ method get_coupons(Str :$ending_before?, Int :$limit?, Str :$starting_after?) {
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine get_coupons: not called CC=17 SCAR=49.2
Branch: 14 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::Str($ending_before) or _failed_check(14, "Str", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::Int($limit) or _failed_check(18, "Int", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::Str($starting_after) or _failed_check(14, "Str", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1032 0 my %args = (
1033 path => 'coupons',
1034 ending_before => $ending_before,
1035 limit => $limit,
1036 starting_after => $starting_after,
1037 );
1038 0 $self->_get_all(%args);
1039 }
1040 }
1041  
1042  
1043 2 Discounts: {
1044 0 ▶ method delete_customer_discount(Net::Stripe::Customer|Str :$customer) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine delete_customer_discount: not called CC=12 SCAR=42.6
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(126, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1045 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
1046 0 $customer = $customer->id;
1047 }
1048 0 $self->_delete("customers/$customer/discount");
1049 }
1050 }
1051  
1052  
1053  
1054 2 Invoices: {
1055  
1056 method create_invoice(Net::Stripe::Customer|Str :$customer,
1057 Int :$application_fee?,
1058 Str :$description?,
1059 HashRef :$metadata?,
1060 Net::Stripe::Subscription|Str :$subscription?,
1061 0 ▶ Bool :$auto_advance?) {
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine create_invoice: not called CC=28 SCAR=59.6
Branch: 23 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(127, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'application_fee'} ? : 0 0 0
if (exists $_{"application_fee"}) 0 0 0
Type::Tiny::XS::Int($application_fee) or _failed_check(18, "Int", $application_fee, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'description'} ? : 0 0 0
if (exists $_{"description"}) 0 0 0
Type::Tiny::XS::Str($description) or _failed_check(14, "Str", $description, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
Ref::Util::XS::is_plain_hashref($metadata) or _failed_check(27, "HashRef", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'subscription'} ? : 0 0 0
if (exists $_{"subscription"}) 0 0 0
Type::Tiny::XS::AUTO::TC24($subscription) or _failed_check(128, "InstanceOf[\"Net::Stripe::Subscription\"]|Str", $subscription, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'auto_advance'} ? : 0 0 0
if (exists $_{"auto_advance"}) 0 0 0
Type::Tiny::XS::Bool($auto_advance) or _failed_check(10, "Bool", $auto_advance, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1062 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
1063 0 $customer = $customer->id;
1064 }
1065  
1066 0 ▶ if (ref($subscription)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $subscription) 0 0 0
1067 0 $subscription = $subscription->id;
1068 }
1069  
1070 0 return $self->_post("invoices",
1071 {
1072 customer => $customer,
1073 application_fee => $application_fee,
1074 description => $description,
1075 metadata => $metadata,
1076 subscription => $subscription,
1077 auto_advance => $auto_advance,
1078 });
1079 }
1080  
1081  
1082 method post_invoice(Net::Stripe::Invoice|Str :$invoice,
1083 Int :$application_fee?,
1084 Bool :$closed?,
1085 Bool :$auto_advance?,
1086 Str :$description?,
1087 0 ▶ HashRef :$metadata?) {
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine post_invoice: not called CC=27 SCAR=58.7
Branch: 23 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'invoice'} ? : 0 0 0
if (exists $_{"invoice"}) 0 0 0
Type::Tiny::XS::AUTO::TC32($invoice) or _failed_check(132, "InstanceOf[\"Net::Stripe::Invoice\"]|Str", $invoice, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'application_fee'} ? : 0 0 0
if (exists $_{"application_fee"}) 0 0 0
Type::Tiny::XS::Int($application_fee) or _failed_check(18, "Int", $application_fee, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'closed'} ? : 0 0 0
if (exists $_{"closed"}) 0 0 0
Type::Tiny::XS::Bool($closed) or _failed_check(10, "Bool", $closed, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'auto_advance'} ? : 0 0 0
if (exists $_{"auto_advance"}) 0 0 0
Type::Tiny::XS::Bool($auto_advance) or _failed_check(10, "Bool", $auto_advance, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'description'} ? : 0 0 0
if (exists $_{"description"}) 0 0 0
Type::Tiny::XS::Str($description) or _failed_check(14, "Str", $description, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
Ref::Util::XS::is_plain_hashref($metadata) or _failed_check(27, "HashRef", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1088 0 ▶ if (ref($invoice)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $invoice) 0 0 0
1089 0 $invoice = $invoice->id;
1090 }
1091  
1092 0 return $self->_post("invoices/$invoice",
1093 {
1094 application_fee => $application_fee,
1095 closed => $closed,
1096 auto_advance => $auto_advance,
1097 description => $description,
1098 metadata => $metadata
1099 });
1100 }
1101  
1102 0 ▶ method get_invoice(Str :$invoice_id) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine get_invoice: not called CC=11 SCAR=40.4
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'invoice_id'} ? : 0 0 0
if (exists $_{"invoice_id"}) 0 0 0
Type::Tiny::XS::Str($invoice_id) or _failed_check(14, "Str", $invoice_id, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1103 0 return $self->_get("invoices/$invoice_id");
1104 }
1105  
1106 0 ▶ method pay_invoice(Str :$invoice_id) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine pay_invoice: not called CC=11 SCAR=40.4
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'invoice_id'} ? : 0 0 0
if (exists $_{"invoice_id"}) 0 0 0
Type::Tiny::XS::Str($invoice_id) or _failed_check(14, "Str", $invoice_id, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1107 0 return $self->_post("invoices/$invoice_id/pay");
1108 }
1109  
1110 method get_invoices(Net::Stripe::Customer|Str :$customer?,
1111 Int|HashRef :$date?,
1112 Str :$ending_before?,
1113 Int :$limit?,
1114 0 ▶ Str :$starting_after?) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine get_invoices: not called CC=24 SCAR=56.4
Branch: 20 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(133, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'date'} ? : 0 0 0
if (exists $_{"date"}) 0 0 0
Type::Tiny::XS::AUTO::TC33($date) or _failed_check(134, "Int|HashRef", $date, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::Str($ending_before) or _failed_check(14, "Str", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::Int($limit) or _failed_check(18, "Int", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::Str($starting_after) or _failed_check(14, "Str", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1115 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
1116 0 $customer = $customer->id
1117 }
1118  
1119 0 my %args = (
1120 customer => $customer,
1121 date => $date,
1122 ending_before => $ending_before,
1123 limit => $limit,
1124 starting_after => $starting_after,
1125 );
1126 0 $self->_get('invoices', \%args);
1127 }
1128  
1129 0 ▶ method get_upcominginvoice(Net::Stripe::Customer|Str $customer) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine get_upcominginvoice: not called CC=7 SCAR=33.9
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(135, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
1130 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
1131 0 $customer = $customer->id;
1132 }
1133 0 my %args = (
1134 path => 'invoices/upcoming',
1135 customer => $customer,
1136 );
1137 0 return $self->_get_all(%args);
1138 }
1139 }
1140  
1141  
1142 2 InvoiceItems: {
1143 method create_invoiceitem(Net::Stripe::Customer|Str :$customer,
1144 Int :$amount,
1145 Str :$currency,
1146 Net::Stripe::Invoice|Str :$invoice?,
1147 Net::Stripe::Subscription|Str :$subscription?,
1148 Str :$description?,
1149 0 ▶ HashRef :$metadata?) {
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine create_invoiceitem: not called CC=32 SCAR=62.5
Branch: 26 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(136, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'amount'} ? : 0 0 0
if (exists $_{"amount"}) 0 0 0
Type::Tiny::XS::Int($amount) or _failed_check(18, "Int", $amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'currency'} ? : 0 0 0
if (exists $_{"currency"}) 0 0 0
Type::Tiny::XS::Str($currency) or _failed_check(14, "Str", $currency, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'invoice'} ? : 0 0 0
if (exists $_{"invoice"}) 0 0 0
Type::Tiny::XS::AUTO::TC32($invoice) or _failed_check(137, "InstanceOf[\"Net::Stripe::Invoice\"]|Str", $invoice, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'subscription'} ? : 0 0 0
if (exists $_{"subscription"}) 0 0 0
Type::Tiny::XS::AUTO::TC24($subscription) or _failed_check(138, "InstanceOf[\"Net::Stripe::Subscription\"]|Str", $subscription, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'description'} ? : 0 0 0
if (exists $_{"description"}) 0 0 0
Type::Tiny::XS::Str($description) or _failed_check(14, "Str", $description, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
Ref::Util::XS::is_plain_hashref($metadata) or _failed_check(27, "HashRef", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1150 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
1151 0 $customer = $customer->id;
1152 }
1153  
1154 0 ▶ if (ref($invoice)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $invoice) 0 0 0
1155 0 $invoice = $invoice->id;
1156 }
1157  
1158 0 ▶ if (ref($subscription)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $subscription) 0 0 0
1159 0 $subscription = $subscription->id;
1160 }
1161  
1162 0 my $invoiceitem = Net::Stripe::Invoiceitem->new(customer => $customer,
1163 amount => $amount,
1164 currency => $currency,
1165 invoice => $invoice,
1166 subscription => $subscription,
1167 description => $description,
1168 metadata => $metadata);
1169 0 return $self->_post('invoiceitems', $invoiceitem);
1170 }
1171  
1172  
1173 method post_invoiceitem(Net::Stripe::Invoiceitem|Str :$invoice_item,
1174 Int :$amount?,
1175 Str :$description?,
1176 0 ▶ HashRef :$metadata?) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine post_invoiceitem: not called CC=24 SCAR=57.1
Branch: 17 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'invoice_item'} ? : 0 0 0
if (exists $_{"invoice_item"}) 0 0 0
Type::Tiny::XS::AUTO::TC35($invoice_item) or _failed_check(142, "InstanceOf[\"Net::Stripe::Invoiceitem\"]|Str", $invoice_item, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'amount'} ? : 0 0 0
if (exists $_{"amount"}) 0 0 0
Type::Tiny::XS::Int($amount) or _failed_check(18, "Int", $amount, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'description'} ? : 0 0 0
if (exists $_{"description"}) 0 0 0
Type::Tiny::XS::Str($description) or _failed_check(14, "Str", $description, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'metadata'} ? : 0 0 0
if (exists $_{"metadata"}) 0 0 0
Ref::Util::XS::is_plain_hashref($metadata) or _failed_check(27, "HashRef", $metadata, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1177 0 ▶ if (!defined($amount) && !defined($description) && !defined($metadata)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $amount or defined $description or defined $metadata) 0 0 0
Condition0%0/6
defined $amount or defined $description or defined $metadata
l!l&&r!l&&!r
000
defined $amount or defined $description
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $amount or defined $description or defined $metadata
defined $amount defined $description defined $metadata
Truth table0%0/4
A or B or C
A= defined $amountB= defined $descriptionC= defined $metadata
ABCresult
1XX1
01X1
0011
0000
1178 0 my $item = $invoice_item->clone; $item->clear_currency;
1179 0 return $self->_post("invoiceitems/" . $item->id, $item);
1180 }
1181  
1182 0 ▶ if (ref($invoice_item)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $invoice_item) 0 0 0
1183 0 $invoice_item = $invoice_item->id;
1184 }
1185  
1186 0 return $self->_post("invoiceitems/" . $invoice_item,
1187 {
1188 amount => $amount,
1189 description => $description,
1190 metadata => $metadata
1191 });
1192 }
1193  
1194 0 ▶ method get_invoiceitem(Str :$invoice_item) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine get_invoiceitem: not called CC=11 SCAR=40.4
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'invoice_item'} ? : 0 0 0
if (exists $_{"invoice_item"}) 0 0 0
Type::Tiny::XS::Str($invoice_item) or _failed_check(14, "Str", $invoice_item, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1195 0 return $self->_get("invoiceitems/$invoice_item");
1196 }
1197  
1198 0 ▶ method delete_invoiceitem(Net::Stripe::Invoiceitem|Str :$invoice_item) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine delete_invoiceitem: not called CC=12 SCAR=42.6
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'invoice_item'} ? : 0 0 0
if (exists $_{"invoice_item"}) 0 0 0
Type::Tiny::XS::AUTO::TC35($invoice_item) or _failed_check(143, "InstanceOf[\"Net::Stripe::Invoiceitem\"]|Str", $invoice_item, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1199 0 ▶ if (ref($invoice_item)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $invoice_item) 0 0 0
1200 0 $invoice_item = $invoice_item->id;
1201 }
1202 0 $self->_delete("invoiceitems/$invoice_item");
1203 }
1204  
1205 method get_invoiceitems(HashRef :$created?,
1206 Net::Stripe::Customer|Str :$customer?,
1207 Str :$ending_before?,
1208 Int :$limit?,
1209 0 ▶ Str :$starting_after?) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine get_invoiceitems: not called CC=24 SCAR=56.4
Branch: 20 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'created'} ? : 0 0 0
if (exists $_{"created"}) 0 0 0
Ref::Util::XS::is_plain_hashref($created) or _failed_check(27, "HashRef", $created, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'customer'} ? : 0 0 0
if (exists $_{"customer"}) 0 0 0
Type::Tiny::XS::AUTO::TC9($customer) or _failed_check(144, "InstanceOf[\"Net::Stripe::Customer\"]|Str", $customer, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::Str($ending_before) or _failed_check(14, "Str", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::Int($limit) or _failed_check(18, "Int", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::Str($starting_after) or _failed_check(14, "Str", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1210 0 ▶ if (ref($customer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $customer) 0 0 0
1211 0 $customer = $customer->id;
1212 }
1213 0 my %args = (
1214 path => 'invoiceitems',
1215 customer => $customer,
1216 created => $created,
1217 ending_before => $ending_before,
1218 limit => $limit,
1219 starting_after => $starting_after,
1220 );
1221 0 $self->_get_all(%args);
1222 }
1223 }
1224  
1225 # Helper methods
1226  
1227 0 ▶method _get(Str $path!, HashRef|StripeResourceObject $obj?) {
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine _get: not called CC=11 SCAR=43.8
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
if @_ > 2 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($path) or _failed_check(14, "Str", $path, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
if ($#_ >= 1) 0 0 0
1228 0 my $uri_obj = URI->new( $self->api_base . '/' . $path );
1229  
1230 0 ▶ if ( $obj ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj) 0 0 0
1231 0 my %form_fields = %{ convert_to_form_fields( $obj ) };
1232 0 ▶ $uri_obj->query_form( \%form_fields ) if %form_fields;
Branch: 1 branch
BranchTrueFalseTotal
if %form_fields 0 0 0
1233 }
1234  
1235 0 my $req = GET $uri_obj->as_string;
1236 0 return $self->_make_request($req);
1237 }
1238  
1239 0 ▶method _delete(Str $path!, HashRef|StripeResourceObject $obj?) {
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine _delete: not called CC=11 SCAR=44.4
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
if @_ > 2 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($path) or _failed_check(14, "Str", $path, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
if ($#_ >= 1) 0 0 0
1240 0 my $uri_obj = URI->new( $self->api_base . '/' . $path );
1241  
1242 0 ▶ if ( $obj ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj) 0 0 0
1243 0 my %form_fields = %{ convert_to_form_fields( $obj ) };
1244 0 ▶ $uri_obj->query_form( \%form_fields ) if %form_fields;
Branch: 1 branch
BranchTrueFalseTotal
if %form_fields 0 0 0
1245 }
1246  
1247 0 my $req = DELETE $uri_obj->as_string;
1248 0 return $self->_make_request($req);
1249 }
1250  
1251 4 ▶sub convert_to_form_fields {
Subroutine convert_to_form_fields: called CC=8 SCAR=21.5
Pod documented
1252 4 my $hash = shift;
1253 4 my $stripe_resource_object_type = Moose::Util::TypeConstraints::find_type_constraint( 'StripeResourceObject' );
1254 4 ▶ if (ref($hash) eq 'HASH') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $hash eq 'HASH') { } 2 2 4
elsif ($stripe_resource_object_type->check($hash)) { } 2 0 2
1255 2 my $r = {};
1256 2 foreach my $key (grep { defined($hash->{$_}) }keys %$hash) {
1257 4 ▶ if ( $stripe_resource_object_type->check( $hash->{$key} ) ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($stripe_resource_object_type->check($hash->{$key})) { } 2 2 4
elsif (ref $hash->{$key} eq 'HASH') { } 0 2 2
elsif (ref $hash->{$key} eq 'ARRAY') { } 1 1 2
1258 2 %{$r} = ( %{$r}, %{ convert_to_form_fields($hash->{$key}) } );
1259 } elsif (ref($hash->{$key}) eq 'HASH') {
1260 0 foreach my $fn (keys %{$hash->{$key}}) {
1261 0 $r->{$key . '[' . $fn . ']'} = $hash->{$key}->{$fn};
1262 }
1263 } elsif (ref($hash->{$key}) eq 'ARRAY') {
1264 1 $r->{$key . '[]'} = $hash->{$key};
1265 } else {
1266 1 $r->{$key} = $hash->{$key};
1267 }
1268 }
1269 2 return $r;
1270 } elsif ($stripe_resource_object_type->check($hash)) {
1271 2 return { $hash->form_fields };
1272 }
1273 0 return $hash;
1274 }
1275  
1276 0 ▶method _post(Str $path!, HashRef|StripeResourceObject $obj?) {
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine _post: not called CC=11 SCAR=44.3
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
if @_ > 2 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($path) or _failed_check(14, "Str", $path, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
if ($#_ >= 1) 0 0 0
1277 0 my %headers;
1278 0 ▶ if ( $obj ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj) 0 0 0
1279 0 my %form_fields = %{ convert_to_form_fields( $obj ) };
1280 0 push @{$headers{Content}}, ( $_, $form_fields{$_} ) for sort( keys( %form_fields ) );
1281 }
1282  
1283 0 my $req = POST $self->api_base . '/' . $path, %headers;
1284 0 return $self->_make_request($req);
1285 }
1286  
1287 method _get_response(
1288 HTTP::Request :$req!,
1289 Bool :$suppress_api_version? = 0,
1290 0 ▶) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine _get_response: not called CC=21 SCAR=55.6
Branch: 10 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'req'} ? : 0 0 0
if (exists $_{"req"}) 0 0 0
Type::Tiny::XS::AUTO::TC36($req) or _failed_check(149, "InstanceOf[\"HTTP::Request\"]", $req, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'suppress_api_version'} ? : 0 0 0
Type::Tiny::XS::Bool($suppress_api_version) or _failed_check(10, "Bool", $suppress_api_version, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1291 0 $req->header( Authorization =>
1292 "Basic " . encode_base64($self->api_key . ':'));
1293  
1294 0 ▶ if ($self->api_version && ! $suppress_api_version) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->api_version and not $suppress_api_version) 0 0 0
Condition0%0/3
$self->api_version and not $suppress_api_version
!ll&&!rl&&r
000
MC/DC0%0/2
$self->api_version and not $suppress_api_version
$self->api_version not $suppress_api_version
Truth table0%0/3
A and not(B)
A= $self->api_versionB= not $suppress_api_version
ABresult
0X0
100
111
1295 0 $req->header( 'Stripe-Version' => $self->api_version );
1296 }
1297  
1298 0 ▶ if ($self->debug_network) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->debug_network) 0 0 0
1299 0 print STDERR "Sending to Stripe:\n------\n" . $req->as_string() . "------\n";
1300  
1301 }
1302 0 my $resp = $self->ua->request($req);
1303  
1304 0 ▶ if ($self->debug_network) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->debug_network) 0 0 0
1305 0 print STDERR "Received from Stripe:\n------\n" . $resp->as_string() . "------\n";
1306 }
1307  
1308 0 ▶ if ($resp->code == 200) {
Branch: 2 branches
BranchTrueFalseTotal
if ($resp->code == 200) { } 0 0 0
elsif ($resp->code == 500) { } 0 0 0
1309 0 return $resp;
1310 } elsif ($resp->code == 500) {
1311 0 die Net::Stripe::Error->new(
1312 type => "HTTP request error",
1313 code => $resp->code,
1314 message => $resp->status_line . " - " . $resp->content,
1315 );
1316 }
1317  
1318 0 my $e = eval {
1319 0 my $hash = decode_json($resp->content);
1320 Net::Stripe::Error->new($hash->{error})
1321 0 };
1322 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
1323 0 Net::Stripe::Error->new(
1324 type => "Could not decode HTTP response: $@",
1325 message => $resp->status_line . " - " . $resp->content,
1326 );
1327 };
1328  
1329 0 ▶ warn "$e\n" if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
1330 0 die $e;
1331 }
1332  
1333 0 ▶method _make_request(HTTP::Request $req!) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine _make_request: not called CC=9 SCAR=39.5
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC36($req) or _failed_check(149, "InstanceOf[\"HTTP::Request\"]", $req, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
1334 0 my $resp = $self->_get_response(
1335 req => $req,
1336 );
1337 0 my $ref = decode_json( $resp->content );
1338 0 ▶ if ( ref( $ref ) eq 'ARRAY' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $ref eq 'ARRAY') { } 0 0 0
elsif (ref $ref eq 'HASH') { } 0 0 0
1339 # some list-type data structures are arrayrefs in API versions 2012-09-24 and earlier.
1340 # if those data structures are at the top level, such as when
1341 # we request 'GET /charges/cus_.../', we need to coerce that
1342 # arrayref into the form that Net::Stripe::List expects.
1343 0 return _array_to_object( $ref, $req->uri );
1344 } elsif ( ref( $ref ) eq 'HASH' ) {
1345 # all top-level data structures are hashes in API versions 2012-10-26 and later
1346 0 return _hash_to_object( $ref );
1347 } else {
1348 0 ▶ die Net::Stripe::Error->new(
Condition0%0/2
ref $ref || 'NONREF'
l!l
00
MC/DC0%0/1
ref $ref || 'NONREF'
ref $ref
Truth table0%0/2
A
A= ref $ref
Aresult
11
00
1349 type => "HTTP request error",
1350 message => sprintf(
1351 "Invalid object type returned: '%s'",
1352 ref( $ref ) || 'NONREF',
1353 ),
1354 );
1355 }
1356 }
1357  
1358 3 ▶sub _hash_to_object {
Subroutine _hash_to_object: called CC=12 SCAR=26.9
1359 3 my $hash = shift;
1360  
1361 3 ▶ if ( exists( $hash->{deleted} ) && exists( $hash->{object} ) && $hash->{object} ne 'customer' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{"deleted"} and exists $hash->{"object"} and $hash->{"object"} ne "customer") 0 3 3
Condition33%2/6
exists $hash->{"deleted"} and exists $hash->{"object"} and $hash->{"object"} ne "customer"
!ll&&!rl&&r
300
exists $hash->{"deleted"} and exists $hash->{"object"}
!ll&&!rl&&r
300
MC/DC0%0/3
exists $hash->{"deleted"} and exists $hash->{"object"} and $hash->{"object"} ne "customer"
exists $hash->{"deleted"} exists $hash->{"object"} $hash->{"object"} ne "customer"
Truth table25%1/4
A and B and C
A= exists $hash->{"deleted"}B= exists $hash->{"object"}C= $hash->{"object"} ne "customer"
ABCresult
0XX0
10X0
1100
1111
1362 0 delete( $hash->{object} );
1363 }
1364  
1365 # coerce pre-2011-08-01 API arrayref list format into a hashref
1366 # compatible with Net::Stripe::List
1367 3 $hash = _pre_2011_08_01_processing( $hash );
1368  
1369 # coerce pre-2012-10-26 API invoice lines format into a hashref
1370 # compatible with Net::Stripe::List
1371 3 $hash = _pre_2012_10_26_processing( $hash );
1372  
1373 # coerce post-2015-02-18 source-type args to to card-type args
1374 3 $hash = _post_2015_02_18_processing( $hash );
1375  
1376 # coerce post-2019-10-17 balance to account_balance
1377 3 $hash = _post_2019_10_17_processing( $hash );
1378  
1379 3 foreach my $k (grep { ref($hash->{$_}) } keys %$hash) {
1380 5 my $v = $hash->{$k};
1381 5 ▶ if (ref($v) eq 'HASH' && defined($v->{object})) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $v eq 'HASH' and defined $v->{'object'}) { } 2 3 5
elsif (ref($v) =~ /^(JSON::XS::Boolean|JSON::PP::Boolean)$/) { } 2 1 3
Condition100%3/3
ref $v eq "HASH" and defined $v->{"object"}
!ll&&!rl&&r
212
MC/DC100%2/2
ref $v eq "HASH" and defined $v->{"object"}
ref $v eq "HASH" defined $v->{"object"}
Truth table100%3/3
A and B
A= ref $v eq "HASH"B= defined $v->{"object"}
ABresult
0X0
100
111
1382 2 $hash->{$k} = _hash_to_object($v);
1383 } elsif (ref($v) =~ /^(JSON::XS::Boolean|JSON::PP::Boolean)$/) {
1384 2 ▶ $hash->{$k} = $v ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$v ? : 0 2 2
1385 }
1386 }
1387  
1388 3 ▶ if (defined($hash->{object})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hash->{"object"}) 3 0 3
1389 3 ▶ if ($hash->{object} eq 'list') {
Branch: 1 branch
BranchTrueFalseTotal
if ($hash->{"object"} eq "list") 0 3 3
1390 0 $hash->{data} = [map { _hash_to_object($_) } @{$hash->{data}}];
1391 0 return Net::Stripe::List->new($hash);
1392 }
1393 3 my @words = map { ucfirst($_) } split('_', $hash->{object});
1394 3 my $object = join('', @words);
1395 3 my $class = 'Net::Stripe::' . $object;
1396 3 ▶ if (Class::Load::is_class_loaded($class)) {
Branch: 1 branch
BranchTrueFalseTotal
if (Class::Load::is_class_loaded($class)) 2 1 3
1397 2 return $class->new($hash);
1398 }
1399 }
1400 1 return $hash;
1401 }
1402  
1403 0 ▶sub _array_to_object {
Subroutine _array_to_object: not called CC=1 SCAR=6.9
1404 0 my ( $array, $uri ) = @_;
1405 0 my $list = _array_to_list( $array );
1406 # strip the protocol, domain and query args in order to mimic the
1407 # url returned with Stripe lists in API versions 2012-10-26 and later
1408 0 $uri =~ s#\?.*$##;
1409 0 $uri =~ s#^https://[^/]+##;
1410 0 $list->{url} = $uri;
1411 0 return _hash_to_object( $list );
1412 }
1413  
1414 0 ▶sub _array_to_list {
Subroutine _array_to_list: not called CC=1 SCAR=6.9
1415 0 my $array = shift;
1416 0 my $count = scalar( @$array );
1417 0 my $list = {
1418 object => 'list',
1419 count => $count,
1420 has_more => 0,
1421 data => $array,
1422 total_count => $count,
1423 };
1424 0 return $list;
1425 }
1426  
1427 # coerce pre-2011-08-01 API arrayref list format into a hashref
1428 # compatible with Net::Stripe::List
1429 3 ▶sub _pre_2011_08_01_processing {
Subroutine _pre_2011_08_01_processing: called CC=24 SCAR=58.3
1430 3 my $hash = shift;
1431 3 foreach my $type ( qw/ cards sources subscriptions / ) {
1432 9 ▶ if ( exists( $hash->{$type} ) && ref( $hash->{$type} ) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{$type} and ref $hash->{$type} eq "ARRAY") 0 9 9
Condition33%1/3
exists $hash->{$type} and ref $hash->{$type} eq "ARRAY"
!ll&&!rl&&r
900
MC/DC0%0/2
exists $hash->{$type} and ref $hash->{$type} eq "ARRAY"
exists $hash->{$type} ref $hash->{$type} eq "ARRAY"
Truth table33%1/3
A and B
A= exists $hash->{$type}B= ref $hash->{$type} eq "ARRAY"
ABresult
0X0
100
111
1433 0 $hash->{$type} = _array_to_list( delete( $hash->{$type} ) );
1434 0 my $customer_id;
1435 0 ▶ if ( exists( $hash->{object} ) && $hash->{object} eq 'customer' && exists( $hash->{id} ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $hash->{'object'} and $hash->{'object'} eq 'customer' and exists $hash->{'id'}) { } 0 0 0
elsif (exists $hash->{'customer'}) { } 0 0 0
Condition0%0/6
exists $hash->{"object"} and $hash->{"object"} eq "customer" and exists $hash->{"id"}
!ll&&!rl&&r
000
exists $hash->{"object"} and $hash->{"object"} eq "customer"
!ll&&!rl&&r
000
MC/DC0%0/3
exists $hash->{"object"} and $hash->{"object"} eq "customer" and exists $hash->{"id"}
exists $hash->{"object"} $hash->{"object"} eq "customer" exists $hash->{"id"}
Truth table0%0/4
A and B and C
A= exists $hash->{"object"}B= $hash->{"object"} eq "customer"C= exists $hash->{"id"}
ABCresult
0XX0
10X0
1100
1111
1436 0 $customer_id = $hash->{id};
1437 } elsif ( exists( $hash->{customer} ) ) {
1438 0 $customer_id = $hash->{customer};
1439 }
1440 # Net::Stripe::List->new() will fail without url, but we
1441 # can make debugging easier by providing a message here
1442 0 ▶ die Net::Stripe::Error->new(
Branch: 1 branch
BranchTrueFalseTotal
unless $customer_id 0 0 0
1443 type => "object coercion error",
1444 message => sprintf(
1445 "Could not determine customer id while coercing %s list into Net::Stripe::List.",
1446 $type,
1447 ),
1448 ) unless $customer_id;
1449  
1450 # mimic the url sent with standard Stripe lists
1451 0 $hash->{$type}->{url} = "/v1/customers/$customer_id/$type";
1452 }
1453 }
1454  
1455 3 foreach my $type ( qw/ refunds / ) {
1456 3 ▶ if ( exists( $hash->{$type} ) && ref( $hash->{$type} ) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{$type} and ref $hash->{$type} eq "ARRAY") 0 3 3
Condition33%1/3
exists $hash->{$type} and ref $hash->{$type} eq "ARRAY"
!ll&&!rl&&r
300
MC/DC0%0/2
exists $hash->{$type} and ref $hash->{$type} eq "ARRAY"
exists $hash->{$type} ref $hash->{$type} eq "ARRAY"
Truth table33%1/3
A and B
A= exists $hash->{$type}B= ref $hash->{$type} eq "ARRAY"
ABresult
0X0
100
111
1457 0 $hash->{$type} = _array_to_list( delete( $hash->{$type} ) );
1458 0 my $charge_id;
1459 0 ▶ if ( exists( $hash->{object} ) && $hash->{object} eq 'charge' && exists( $hash->{id} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{"object"} and $hash->{"object"} eq "charge" and exists $hash->{"id"}) 0 0 0
Condition0%0/6
exists $hash->{"object"} and $hash->{"object"} eq "charge" and exists $hash->{"id"}
!ll&&!rl&&r
000
exists $hash->{"object"} and $hash->{"object"} eq "charge"
!ll&&!rl&&r
000
MC/DC0%0/3
exists $hash->{"object"} and $hash->{"object"} eq "charge" and exists $hash->{"id"}
exists $hash->{"object"} $hash->{"object"} eq "charge" exists $hash->{"id"}
Truth table0%0/4
A and B and C
A= exists $hash->{"object"}B= $hash->{"object"} eq "charge"C= exists $hash->{"id"}
ABCresult
0XX0
10X0
1100
1111
1460 0 $charge_id = $hash->{id};
1461 }
1462 # Net::Stripe::List->new() will fail without url, but we
1463 # can make debugging easier by providing a message here
1464 0 ▶ die Net::Stripe::Error->new(
Branch: 1 branch
BranchTrueFalseTotal
unless $charge_id 0 0 0
1465 type => "object coercion error",
1466 message => sprintf(
1467 "Could not determine charge id while coercing %s list into Net::Stripe::List.",
1468 $type,
1469 ),
1470 ) unless $charge_id;
1471 # mimic the url sent with standard Stripe lists
1472 0 $hash->{$type}->{url} = "/v1/charges/$charge_id/$type";
1473 }
1474 }
1475  
1476 3 foreach my $type ( qw/ charges / ) {
1477 3 ▶ if ( exists( $hash->{$type} ) && ref( $hash->{$type} ) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{$type} and ref $hash->{$type} eq "ARRAY") 0 3 3
Condition33%1/3
exists $hash->{$type} and ref $hash->{$type} eq "ARRAY"
!ll&&!rl&&r
300
MC/DC0%0/2
exists $hash->{$type} and ref $hash->{$type} eq "ARRAY"
exists $hash->{$type} ref $hash->{$type} eq "ARRAY"
Truth table33%1/3
A and B
A= exists $hash->{$type}B= ref $hash->{$type} eq "ARRAY"
ABresult
0X0
100
111
1478 0 $hash->{$type} = _array_to_list( delete( $hash->{$type} ) );
1479 0 my $payment_intent_id;
1480 0 ▶ if ( exists( $hash->{object} ) && $hash->{object} eq 'payment_intent' && exists( $hash->{id} ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $hash->{'object'} and $hash->{'object'} eq 'payment_intent' and exists $hash->{'id'}) { } 0 0 0
elsif (exists $hash->{'payment_intent'}) { } 0 0 0
Condition0%0/6
exists $hash->{"object"} and $hash->{"object"} eq "payment_intent" and exists $hash->{"id"}
!ll&&!rl&&r
000
exists $hash->{"object"} and $hash->{"object"} eq "payment_intent"
!ll&&!rl&&r
000
MC/DC0%0/3
exists $hash->{"object"} and $hash->{"object"} eq "payment_intent" and exists $hash->{"id"}
exists $hash->{"object"} $hash->{"object"} eq "payment_intent" exists $hash->{"id"}
Truth table0%0/4
A and B and C
A= exists $hash->{"object"}B= $hash->{"object"} eq "payment_intent"C= exists $hash->{"id"}
ABCresult
0XX0
10X0
1100
1111
1481 0 $payment_intent_id = $hash->{id};
1482 } elsif ( exists( $hash->{payment_intent} ) ) {
1483 0 $payment_intent_id = $hash->{payment_intent};
1484 }
1485 # Net::Stripe::List->new() will fail without url, but we
1486 # can make debugging easier by providing a message here
1487 0 ▶ die Net::Stripe::Error->new(
Branch: 1 branch
BranchTrueFalseTotal
unless $payment_intent_id 0 0 0
1488 type => "object coercion error",
1489 message => sprintf(
1490 "Could not determine payment_intent id while coercing %s list into Net::Stripe::List.",
1491 $type,
1492 ),
1493 ) unless $payment_intent_id;
1494  
1495 # mimic the url sent with standard Stripe lists
1496 0 $hash->{$type}->{url} = "/v1/charges?payment_intent=$payment_intent_id";
1497 }
1498 }
1499  
1500 3 return $hash;
1501 }
1502  
1503 # coerce pre-2012-10-26 API invoice lines format into a hashref
1504 # compatible with Net::Stripe::List
1505 3 ▶sub _pre_2012_10_26_processing {
Subroutine _pre_2012_10_26_processing: called CC=11 SCAR=42.4
1506 3 my $hash = shift;
1507 3 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{"object"} and $hash->{"object"} eq "invoice" and exists $hash->{"lines"} and ref $hash->{"lines"} eq "HASH" and not exists $hash->{"lines"}{"object"}) 0 3 3
Condition33%4/12
exists $hash->{"object"} and $hash->{"object"} eq "invoice" and exists $hash->{"lines"} and ref $hash->{"lines"} eq "HASH" and not exists $hash->{"lines"}{"object"}
!ll&&!rl&&r
300
exists $hash->{"object"} and $hash->{"object"} eq "invoice" and exists $hash->{"lines"} and ref $hash->{"lines"} eq "HASH"
!ll&&!rl&&r
300
exists $hash->{"object"} and $hash->{"object"} eq "invoice" and exists $hash->{"lines"}
!ll&&!rl&&r
300
exists $hash->{"object"} and $hash->{"object"} eq "invoice"
!ll&&!rl&&r
030
MC/DC0%0/5
exists $hash->{"object"} and $hash->{"object"} eq "invoice" and exists $hash->{"lines"} and ref $hash->{"lines"} eq "HASH" and not exists $hash->{"lines"}{"object"}
exists $hash->{"object"} $hash->{"object"} eq "invoice" exists $hash->{"lines"} ref $hash->{"lines"} eq "HASH" not exists $hash->{"lines"}{"object"}
Truth table16%1/6
A and B and C and D and not(E)
A= exists $hash->{"object"}B= $hash->{"object"} eq "invoice"C= exists $hash->{"lines"}D= ref $hash->{"lines"} eq "HASH"E= not exists $hash->{"lines"}{"object"}
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
1508 exists( $hash->{object} ) && $hash->{object} eq 'invoice' &&
1509 exists( $hash->{lines} ) && ref( $hash->{lines} ) eq 'HASH' &&
1510 ! exists( $hash->{lines}->{object} )
1511 ) {
1512 0 my $data = [];
1513 0 my $lines = delete( $hash->{lines} );
1514 0 foreach my $key ( sort( keys( %$lines ) ) ) {
1515 0 my $ref = $lines->{$key};
1516 0 ▶ unless ( ref( $ref ) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $ref eq "ARRAY") 0 0 0
1517 0 die Net::Stripe::Error->new(
1518 type => "object coercion error",
1519 message => sprintf(
1520 "Found invalid subkey type '%s' while coercing invoice lines into a Net::Stripe::List.",
1521 ref( $ref ),
1522 ),
1523 );
1524 }
1525 0 foreach my $item ( @$ref ) {
1526 0 push @$data, $item;
1527 }
1528 }
1529 0 $hash->{lines} = _array_to_list( $data );
1530  
1531 0 my $customer_id;
1532 0 ▶ if ( exists( $hash->{customer} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{"customer"}) 0 0 0
1533 0 $customer_id = $hash->{customer};
1534 }
1535 # Net::Stripe::List->new() will fail without url, but we
1536 # can make debugging easier by providing a message here
1537 0 ▶ die Net::Stripe::Error->new(
Branch: 1 branch
BranchTrueFalseTotal
unless $customer_id 0 0 0
1538 type => "object coercion error",
1539 message => "Could not determine customer id while coercing invoice lines into Net::Stripe::List.",
1540 ) unless $customer_id;
1541  
1542 # mimic the url sent with standard Stripe lists
1543 0 $hash->{lines}->{url} = "/v1/invoices/upcoming/lines?customer=$customer_id";
1544 }
1545 3 return $hash;
1546 }
1547  
1548 # coerce post-2015-02-18 source-type args to to card-type args
1549 3 ▶sub _post_2015_02_18_processing {
Subroutine _post_2015_02_18_processing: called CC=17 SCAR=53.9
1550 3 my $hash = shift;
1551  
1552 3 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{"object"} and $hash->{"object"} eq "charge" || $hash->{"object"} eq "customer") 0 3 3
Condition33%2/6
exists $hash->{"object"} and $hash->{"object"} eq "charge" || $hash->{"object"} eq "customer"
!ll&&!rl&&r
030
$hash->{"object"} eq "charge" or $hash->{"object"} eq "customer"
l!l&&r!l&&!r
003
MC/DC0%0/3
exists $hash->{"object"} and $hash->{"object"} eq "charge" || $hash->{"object"} eq "customer"
exists $hash->{"object"} $hash->{"object"} eq "charge" $hash->{"object"} eq "customer"
Truth table25%1/4
A and B or C
A= exists $hash->{"object"}B= $hash->{"object"} eq "charge"C= $hash->{"object"} eq "customer"
ABCresult
0XX0
1000
11X1
1011
1553 exists( $hash->{object} ) &&
1554 ( $hash->{object} eq 'charge' || $hash->{object} eq 'customer' )
1555 ) {
1556 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $hash->{"card"} and exists $hash->{"source"} and ref $hash->{"source"} eq "HASH" and exists $hash->{"source"}{"object"} and $hash->{"source"}{"object"} eq "card") 0 0 0
Condition0%0/12
not exists $hash->{"card"} and exists $hash->{"source"} and ref $hash->{"source"} eq "HASH" and exists $hash->{"source"}{"object"} and $hash->{"source"}{"object"} eq "card"
!ll&&!rl&&r
000
not exists $hash->{"card"} and exists $hash->{"source"} and ref $hash->{"source"} eq "HASH" and exists $hash->{"source"}{"object"}
!ll&&!rl&&r
000
not exists $hash->{"card"} and exists $hash->{"source"} and ref $hash->{"source"} eq "HASH"
!ll&&!rl&&r
000
not exists $hash->{"card"} and exists $hash->{"source"}
!ll&&!rl&&r
000
MC/DC0%0/5
not exists $hash->{"card"} and exists $hash->{"source"} and ref $hash->{"source"} eq "HASH" and exists $hash->{"source"}{"object"} and $hash->{"source"}{"object"} eq "card"
not exists $hash->{"card"} exists $hash->{"source"} ref $hash->{"source"} eq "HASH" exists $hash->{"source"}{"object"} $hash->{"source"}{"object"} eq "card"
Truth table0%0/6
not(A) and B and C and D and E
A= not exists $hash->{"card"}B= exists $hash->{"source"}C= ref $hash->{"source"} eq "HASH"D= exists $hash->{"source"}{"object"}E= $hash->{"source"}{"object"} eq "card"
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
1557 ! exists( $hash->{card} ) &&
1558 exists( $hash->{source} ) && ref( $hash->{source} ) eq 'HASH' &&
1559 exists( $hash->{source}->{object} ) && $hash->{source}->{object} eq 'card'
1560 ) {
1561 0 $hash->{card} = Storable::dclone( $hash->{source} );
1562 }
1563  
1564 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $hash->{"cards"} and exists $hash->{"sources"} and ref $hash->{"sources"} eq "HASH" and exists $hash->{"sources"}{"object"} and $hash->{"sources"}{"object"} eq "list") 0 0 0
Condition0%0/12
not exists $hash->{"cards"} and exists $hash->{"sources"} and ref $hash->{"sources"} eq "HASH" and exists $hash->{"sources"}{"object"} and $hash->{"sources"}{"object"} eq "list"
!ll&&!rl&&r
000
not exists $hash->{"cards"} and exists $hash->{"sources"} and ref $hash->{"sources"} eq "HASH" and exists $hash->{"sources"}{"object"}
!ll&&!rl&&r
000
not exists $hash->{"cards"} and exists $hash->{"sources"} and ref $hash->{"sources"} eq "HASH"
!ll&&!rl&&r
000
not exists $hash->{"cards"} and exists $hash->{"sources"}
!ll&&!rl&&r
000
MC/DC0%0/5
not exists $hash->{"cards"} and exists $hash->{"sources"} and ref $hash->{"sources"} eq "HASH" and exists $hash->{"sources"}{"object"} and $hash->{"sources"}{"object"} eq "list"
not exists $hash->{"cards"} exists $hash->{"sources"} ref $hash->{"sources"} eq "HASH" exists $hash->{"sources"}{"object"} $hash->{"sources"}{"object"} eq "list"
Truth table0%0/6
not(A) and B and C and D and E
A= not exists $hash->{"cards"}B= exists $hash->{"sources"}C= ref $hash->{"sources"} eq "HASH"D= exists $hash->{"sources"}{"object"}E= $hash->{"sources"}{"object"} eq "list"
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
1565 ! exists( $hash->{cards} ) &&
1566 exists( $hash->{sources} ) && ref( $hash->{sources} ) eq 'HASH' &&
1567 exists( $hash->{sources}->{object} ) && $hash->{sources}->{object} eq 'list'
1568 ) {
1569 0 $hash->{cards} = Storable::dclone( $hash->{sources} );
1570 }
1571  
1572 0 my $card_id_type = Moose::Util::TypeConstraints::find_type_constraint( 'StripeCardId' );
1573 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $hash->{"default_card"} and exists $hash->{"default_source"} and $card_id_type->check($hash->{"default_source"})) 0 0 0
Condition0%0/6
not exists $hash->{"default_card"} and exists $hash->{"default_source"} and $card_id_type->check($hash->{"default_source"})
!ll&&!rl&&r
000
not exists $hash->{"default_card"} and exists $hash->{"default_source"}
!ll&&!rl&&r
000
MC/DC0%0/3
not exists $hash->{"default_card"} and exists $hash->{"default_source"} and $card_id_type->check($hash->{"default_source"})
not exists $hash->{"default_card"} exists $hash->{"default_source"} $card_id_type->check($hash->{"default_source"})
Truth table0%0/4
not(A) and B and C
A= not exists $hash->{"default_card"}B= exists $hash->{"default_source"}C= $card_id_type->check($hash->{"default_source"})
ABCresult
0XX0
10X0
1100
1111
1574 ! exists( $hash->{default_card} ) &&
1575 exists( $hash->{default_source} ) &&
1576 $card_id_type->check( $hash->{default_source} )
1577 ) {
1578 0 $hash->{default_card} = $hash->{default_source};
1579 }
1580 }
1581 3 return $hash;
1582 }
1583  
1584 # coerce post-2019-10-17 balance to account_balance
1585 fun _post_2019_10_17_processing(
1586 HashRef $hash,
1587 2 ▶) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _post_2019_10_17_processing: called CC=9 SCAR=26.2
Branch: 4 branches
BranchTrueFalseTotal
if @_ != 1 0 3 3
$#_ >= 0 ? : 3 0 3
if ($#_ >= 0) 3 0 3
Ref::Util::XS::is_plain_hashref($hash) or _failed_check(27, "HashRef", $hash, "exception_class", "Error::TypeTiny::Assertion") 3 0 3
1588 3 ▶ if ( exists( $hash->{object} ) && $hash->{object} eq 'customer' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{"object"} and $hash->{"object"} eq "customer") 0 3 3
Condition33%1/3
exists $hash->{"object"} and $hash->{"object"} eq "customer"
!ll&&!rl&&r
030
MC/DC0%0/2
exists $hash->{"object"} and $hash->{"object"} eq "customer"
exists $hash->{"object"} $hash->{"object"} eq "customer"
Truth table33%1/3
A and B
A= exists $hash->{"object"}B= $hash->{"object"} eq "customer"
ABresult
0X0
100
111
1589 0 ▶ if ( ! exists( $hash->{account_balance} ) && exists( $hash->{balance} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $hash->{"account_balance"} and exists $hash->{"balance"}) 0 0 0
Condition0%0/3
not exists $hash->{"account_balance"} and exists $hash->{"balance"}
!ll&&!rl&&r
000
MC/DC0%0/2
not exists $hash->{"account_balance"} and exists $hash->{"balance"}
not exists $hash->{"account_balance"} exists $hash->{"balance"}
Truth table0%0/3
not(A) and B
A= not exists $hash->{"account_balance"}B= exists $hash->{"balance"}
ABresult
0X0
100
111
1590 0 $hash->{account_balance} = $hash->{balance};
1591 }
1592 }
1593 3 return $hash;
1594 }
1595  
1596 method _get_all(
1597 Str :$path!,
1598 Maybe[Str] :$ending_before?,
1599 Maybe[Int] :$limit?,
1600 Maybe[Str] :$starting_after?,
1601 %object_filters,
1602 0 ▶) {
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine BEGIN: called CC=1 SCAR=3.4
Subroutine _get_all: not called CC=36 SCAR=66.5
Branch: 18 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
exists $_{'path'} ? : 0 0 0
if (exists $_{"path"}) 0 0 0
Type::Tiny::XS::Str($path) or _failed_check(14, "Str", $path, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ending_before'} ? : 0 0 0
if (exists $_{"ending_before"}) 0 0 0
Type::Tiny::XS::AUTO::TC38($ending_before) or _failed_check(151, "Maybe[Str]", $ending_before, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'limit'} ? : 0 0 0
if (exists $_{"limit"}) 0 0 0
Type::Tiny::XS::AUTO::TC3($limit) or _failed_check(47, "Maybe[Int]", $limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'starting_after'} ? : 0 0 0
if (exists $_{"starting_after"}) 0 0 0
Type::Tiny::XS::AUTO::TC38($starting_after) or _failed_check(151, "Maybe[Str]", $starting_after, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ == 0 && ref $_[0] eq 'HASH' ? : 0 0 0
%tmp ? : 0 0 0
Condition0%0/6
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1603  
1604 # minimize the number of API calls by retrieving as many results as
1605 # possible per call. the API currently returns a maximum of 100 results.
1606 0 my $API_PAGE_SIZE = 100;
1607 0 my $PAGE_SIZE = $limit;
1608 0 my $GET_MORE;
1609 0 ▶ if ( defined( $limit ) && ( $limit eq '0' || $limit > $API_PAGE_SIZE ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $limit and $limit eq 0 || $limit > $API_PAGE_SIZE) 0 0 0
Condition0%0/6
defined $limit and $limit eq 0 || $limit > $API_PAGE_SIZE
!ll&&!rl&&r
000
$limit eq 0 or $limit > $API_PAGE_SIZE
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $limit and $limit eq 0 || $limit > $API_PAGE_SIZE
defined $limit $limit eq 0 $limit > $API_PAGE_SIZE
Truth table0%0/4
A and B or C
A= defined $limitB= $limit eq 0C= $limit > $API_PAGE_SIZE
ABCresult
0XX0
1000
11X1
1011
1610 0 $PAGE_SIZE = $API_PAGE_SIZE;
1611 0 $GET_MORE = 1;
1612 }
1613  
1614 0 my %args = (
1615 %object_filters,
1616 ending_before => $ending_before,
1617 limit => $PAGE_SIZE,
1618 starting_after => $starting_after,
1619 );
1620 0 my $list = $self->_get($path, \%args);
1621  
1622 0 ▶ if ( $GET_MORE && $list->elements() > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($GET_MORE and $list->elements > 0) 0 0 0
Condition0%0/3
$GET_MORE and $list->elements > 0
!ll&&!rl&&r
000
MC/DC0%0/2
$GET_MORE and $list->elements > 0
$GET_MORE $list->elements > 0
Truth table0%0/3
A and B
A= $GET_MOREB= $list->elements > 0
ABresult
0X0
100
111
1623 # passing 'ending_before' causes the API to start with the oldest
1624 # records. so in order to always provide records in reverse-chronological
1625 # order, we must prepend these to the existing records.
1626 0 ▶ my $REVERSE = defined( $ending_before ) && ! defined( $starting_after );
Condition0%0/3
defined $ending_before && !defined($starting_after)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ending_before && !defined($starting_after)
defined $ending_before !defined($starting_after)
Truth table0%0/3
A && not(B)
A= defined $ending_beforeB= !defined($starting_after)
ABresult
0X0
100
111
1627 0 ▶ my $MAX_COUNT = $limit eq '0' ? undef : $limit;
Branch: 1 branch
BranchTrueFalseTotal
$limit eq '0' ? : 0 0 0
1628 0 while ( 1 ) {
1629 0 my $PAGE_SIZE = $API_PAGE_SIZE;
1630 0 ▶ if ( defined( $MAX_COUNT ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $MAX_COUNT) 0 0 0
1631 0 my $TO_FETCH = $MAX_COUNT - scalar( $list->elements );
1632 0 ▶ last if $TO_FETCH <= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $TO_FETCH <= 0 0 0 0
1633 0 ▶ $PAGE_SIZE = $TO_FETCH if $TO_FETCH < $PAGE_SIZE;
Branch: 1 branch
BranchTrueFalseTotal
if $TO_FETCH < $PAGE_SIZE 0 0 0
1634 }
1635  
1636 0 ▶ my %args = (
Branch: 1 branch
BranchTrueFalseTotal
$REVERSE ? : 0 0 0
1637 %object_filters,
1638 limit => $PAGE_SIZE,
1639 ( $REVERSE ? $list->_previous_page_args() : $list->_next_page_args() ),
1640 );
1641 0 my $page = $self->_get($path, \%args);
1642  
1643 0 ▶ last if $page->is_empty;
Branch: 1 branch
BranchTrueFalseTotal
if $page->is_empty 0 0 0
1644  
1645 0 ▶ $list = Net::Stripe::List::_merge_lists(
Branch: 1 branch
BranchTrueFalseTotal
$REVERSE ? : 0 0 0
1646 lists => [ $REVERSE ?
1647 ( $page, $list ) :
1648 ( $list, $page )
1649 ],
1650 );
1651  
1652 0 ▶ last unless $page->has_more;
Branch: 1 branch
BranchTrueFalseTotal
unless $page->has_more 0 0 0
1653  
1654 }
1655 }
1656 0 return $list;
1657 }
1658  
1659 fun _encode_boolean(
1660 Bool $value!,
1661 2 ▶) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _encode_boolean: called CC=7 SCAR=19.7
Branch: 4 branches
BranchTrueFalseTotal
if @_ != 1 0 3 3
$#_ >= 0 ? : 3 0 3
if ($#_ >= 0) 3 0 3
Type::Tiny::XS::Bool($value) or _failed_check(10, "Bool", $value, "exception_class", "Error::TypeTiny::Assertion") 3 0 3
1662 # a bare `return` with no arguemnts evaluates to an empty list, resulting
1663 # in 'odd number of elements in hash assignment, so we must return undef
1664 3 ▶ return undef unless defined( $value );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 1 2 3
1665 2 ▶ return $value ? 'true' : 'false';
Branch: 1 branch
BranchTrueFalseTotal
$value ? : 1 1 2
1666 }
1667  
1668 0 ▶method _build_api_base { 'https://api.stripe.com/v1' }
Subroutine BEGIN: called CC=1 SCAR=1.6
Subroutine _build_api_base: not called CC=2 SCAR=9.9
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
1669  
1670 0 ▶method _build_ua {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine _build_ua: not called CC=3 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
1671 0 my $ua = LWP::UserAgent->new(keep_alive => 4);
1672 0 ▶ $ua->agent("Net::Stripe/" . ($Net::Stripe::VERSION || 'dev'));
Condition0%0/2
$Net::Stripe::VERSION || 'dev'
l!l
00
MC/DC0%0/1
$Net::Stripe::VERSION || 'dev'
$Net::Stripe::VERSION
Truth table0%0/2
A
A= $Net::Stripe::VERSION
Aresult
11
00
1673 0 return $ua;
1674 }
1675  
1676 # since the Stripe API does not have a ping-like method, we have to perform
1677 # an extraneous request in order to retrieve the Stripe-Version header with
1678 # the response. for now, we will use the 'balance' endpoint because it one of
1679 # the simplest and least-privileged.
1680 method _get_stripe_verison_header(
1681 Bool :$suppress_api_version? = 0,
1682 0 ▶) {
Subroutine BEGIN: called CC=1 SCAR=3.0
Subroutine BEGIN: called CC=1 SCAR=3.0
Subroutine BEGIN: called CC=1 SCAR=3.0
Subroutine BEGIN: called CC=1 SCAR=3.0
Subroutine BEGIN: called CC=1 SCAR=3.0
Subroutine _get_stripe_verison_header: not called CC=13 SCAR=45.0
Branch: 7 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'suppress_api_version'} ? : 0 0 0
Type::Tiny::XS::Bool($suppress_api_version) or _failed_check(10, "Bool", $suppress_api_version, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1683 0 my $path = 'balance';
1684 0 my $req = GET $self->api_base . '/' . $path;
1685  
1686 # swallow the possible invalid API version warning
1687 0 ▶ local $SIG{__WARN__} = sub {};
Subroutine __ANON__: not called CC=1 SCAR=6.9
1688 0 my $resp = $self->_get_response(
1689 req => $req,
1690 suppress_api_version => $suppress_api_version,
1691 );
1692  
1693 0 my $stripe_version = $resp->header( 'Stripe-Version' );
1694 0 my $stripe_api_version_type = Moose::Util::TypeConstraints::find_type_constraint( 'StripeAPIVersion' );
1695 0 ▶ die Net::Stripe::Error->new(
Branch: 2 branches
BranchTrueFalseTotal
unless defined $stripe_version and $stripe_api_version_type->check($stripe_version) 0 0 0
defined $stripe_version ? : 0 0 0
Condition0%0/3
defined $stripe_version and $stripe_api_version_type->check($stripe_version)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $stripe_version and $stripe_api_version_type->check($stripe_version)
defined $stripe_version $stripe_api_version_type->check($stripe_version)
Truth table0%0/3
A and B
A= defined $stripe_versionB= $stripe_api_version_type->check($stripe_version)
ABresult
0X0
100
111
1696 type => "API version validation error",
1697 message => sprintf( "Failed to retrieve the Stripe-Version header: '%s'",
1698 defined( $stripe_version ) ? $stripe_version : 'undefined',
1699 ),
1700 ) unless defined( $stripe_version ) && $stripe_api_version_type->check( $stripe_version );
1701  
1702 0 return $stripe_version;
1703 }
1704  
1705 0 ▶method _get_account_api_version {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine _get_account_api_version: not called CC=2 SCAR=10.5
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
1706 0 my $stripe_version = $self->_get_stripe_verison_header(
1707 suppress_api_version => 1,
1708 );
1709 0 return $stripe_version;
1710 }
1711  
1712 # if we have set an explicit API version, confirm that it is valid. if
1713 # it is invalid, _get_response() dies with an invalid_request_error.
1714 0 ▶method _validate_api_version_value {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine _validate_api_version_value: not called CC=4 SCAR=23.7
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
1715 0 ▶ return unless defined( $self->api_version );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->api_version 0 0 0
1716  
1717 0 my $stripe_version = $self->_get_stripe_verison_header();
1718 0 ▶ die Net::Stripe::Error->new(
Branch: 1 branch
BranchTrueFalseTotal
unless $stripe_version eq $self->api_version 0 0 0
1719 type => "API version validation error",
1720 message => sprintf( "Stripe API version mismatch. Sent: '%s'. Received: '%s'.",
1721 $self->api_version,
1722 $stripe_version,
1723 ),
1724 ) unless $stripe_version eq $self->api_version;
1725  
1726 0 return 1;
1727 }
1728  
1729 # if we have set an explicit API version, confirm that it is within the
1730 # appropriate range. otherwise, retrieve the default value for this
1731 # account and confirm that it is within the appropriate range.
1732 2 ▶method _validate_api_version_range {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _validate_api_version_range: called CC=8 SCAR=28.9
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 1 0 1
1733 1 ▶ if ( $self->force_api_version ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->force_api_version) 0 1 1
1734 0 ▶ warn "bypassing API version range safety check" if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
1735 0 return 1;
1736 }
1737  
1738 1 ▶ my $api_version = defined( $self->api_version ) ? $self->api_version : $self->_get_account_api_version();
Branch: 1 branch
BranchTrueFalseTotal
defined $self->api_version ? : 1 0 1
1739  
1740 1 my @api_version = split( '-', $api_version );
1741 1 my $api_version_dt;
1742 1 eval {
1743 1 $api_version_dt = DateTime->new(
1744 year => $api_version[0],
1745 month => $api_version[1],
1746 day => $api_version[2],
1747 time_zone => 'UTC',
1748 );
1749 };
1750 1 ▶ if ( my $error = $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $error = $@) 1 0 1
1751 1 die Net::Stripe::Error->new(
1752 type => "API version validation error",
1753 message => sprintf( "Invalid date string '%s' provided for api_version: %s",
1754 $api_version,
1755 $error,
1756 ),
1757 );
1758 }
1759  
1760 0 my @min_api_version = split( '-', Net::Stripe::Constants::MIN_API_VERSION );
1761 0 my $min_api_version_dt = DateTime->new(
1762 year => $min_api_version[0],
1763 month => $min_api_version[1],
1764 day => $min_api_version[2],
1765 time_zone => 'UTC',
1766 );
1767  
1768 0 my @max_api_version = split( '-', Net::Stripe::Constants::MAX_API_VERSION );
1769 0 my $max_api_version_dt = DateTime->new(
1770 year => $max_api_version[0],
1771 month => $max_api_version[1],
1772 day => $max_api_version[2],
1773 time_zone => 'UTC',
1774 );
1775  
1776 0 my $format = "Stripe API version %s is not supported by this version of Net::Stripe. " .
1777 "This version of Net::Stripe only supports Stripe API versions from %s to %s. " .
1778 "Please check for a version-appropriate branch at https://github.com/lukec/stripe-perl/branches.";
1779 0 my $message = sprintf( $format,
1780 $api_version,
1781 Net::Stripe::Constants::MIN_API_VERSION,
1782 Net::Stripe::Constants::MAX_API_VERSION,
1783 );
1784 0 ▶ die Net::Stripe::Error->new(
Branch: 1 branch
BranchTrueFalseTotal
unless $min_api_version_dt <= $api_version_dt and $api_version_dt <= $max_api_version_dt 0 0 0
Condition0%0/3
$min_api_version_dt <= $api_version_dt and $api_version_dt <= $max_api_version_dt
!ll&&!rl&&r
000
MC/DC0%0/2
$min_api_version_dt <= $api_version_dt and $api_version_dt <= $max_api_version_dt
$min_api_version_dt <= $api_version_dt $api_version_dt <= $max_api_version_dt
Truth table0%0/3
A and B
A= $min_api_version_dt <= $api_version_dtB= $api_version_dt <= $max_api_version_dt
ABresult
0X0
100
111
1785 type => "API version validation error",
1786 message => $message,
1787 ) unless $min_api_version_dt <= $api_version_dt && $api_version_dt <= $max_api_version_dt;
1788  
1789 0 return 1;
1790 }
1791  
1792  
1793 2 __PACKAGE__->meta->make_immutable;
1794 2 1;
1795  
1796 __END__
↑ Summary Stripe/Customer.pm »