Twilio/Rest/Api/V2010/Account/Call/Payment.pm

filter: Statementstmt 93.6% 59 / 63 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 91.3% 21 / 23 Podpod n/a totaltotal 86.6% 84 / 97 CC 4 SCAR 2.7
CC
4
Cov
90%
create
2.0
update
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/PreviewIam/Versionless/Organization/User.pm ↑ Summary Twilio/Rest/Events/V1/Sink.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Api::V2010::Account::Call::Payment;
3  
4 2 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '2.001';
8  
9 package Twilio::Rest::Api::V2010::Account::Call::PaymentList;
10  
11 2 ▶use parent 'Twilio::ListResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 2 my ($class, $version, $account_sid, $call_sid) = @_;
17 2 my $self = $class->SUPER::new($version);
18 2 $self->{solution} = { account_sid => $account_sid, call_sid => $call_sid };
19 2 $self->{uri} = join q{}, '/Accounts/', Twilio::Serialize::path_segment($account_sid), '/Calls/',
20 Twilio::Serialize::path_segment($call_sid), '/Payments.json';
21 2 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $idempotency_key, $status_callback, $options) = @_;
26 1 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
10
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
27  
28 my $data = {
29 IdempotencyKey => $idempotency_key,
30 StatusCallback => $status_callback,
31 BankAccountType => $options->{bank_account_type},
32 ChargeAmount => $options->{charge_amount},
33 Confirmation => $options->{confirmation},
34 Currency => $options->{currency},
35 Description => $options->{description},
36 Input => $options->{input},
37 MinPostalCodeLength => $options->{min_postal_code_length},
38 Parameter => Twilio::Serialize::json_object($options->{parameter}),
39 PaymentConnector => $options->{payment_connector},
40 PaymentMethod => $options->{payment_method},
41 PostalCode => Twilio::Serialize::boolean_to_string($options->{postal_code}),
42 RequireMatchingInputs => $options->{require_matching_inputs},
43 SecurityCode => Twilio::Serialize::boolean_to_string($options->{security_code}),
44 Timeout => $options->{timeout},
45 TokenType => $options->{token_type},
46 ValidCardTypes => $options->{valid_card_types},
47 1 };
48  
49 my $response =
50 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
51 return Twilio::Rest::Api::V2010::Account::Call::PaymentInstance->new(
52 $self->{version}, $response->get_content,
53 $self->{solution}{account_sid},
54 $self->{solution}{call_sid}
55 1 );
56 }
57  
58 1 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
59 1 my ($self, $sid) = @_;
60 return Twilio::Rest::Api::V2010::Account::Call::PaymentContext->new(
61 $self->{version},
62 $self->{solution}{account_sid},
63 1 $self->{solution}{call_sid}, $sid
64 );
65 }
66  
67 package Twilio::Rest::Api::V2010::Account::Call::PaymentContext;
68  
69 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
70  
71 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
72  
73 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
74 1 my ($class, $version, $account_sid, $call_sid, $sid) = @_;
75 1 my $self = $class->SUPER::new($version);
76 1 $self->{solution} = { account_sid => $account_sid, call_sid => $call_sid, sid => $sid };
77 1 $self->{uri} = join q{}, '/Accounts/', Twilio::Serialize::path_segment($account_sid), '/Calls/',
78 Twilio::Serialize::path_segment($call_sid), '/Payments/',
79 Twilio::Serialize::path_segment($sid), '.json';
80 1 return $self;
81 }
82  
83 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
84 1 my ($self, $idempotency_key, $status_callback, $options) = @_;
85 1 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
10
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
86  
87 my $data = {
88 IdempotencyKey => $idempotency_key,
89 StatusCallback => $status_callback,
90 Capture => $options->{capture},
91 Status => $options->{status},
92 1 };
93  
94 my $response =
95 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
96 1 return $self->_build_instance($response);
97 }
98  
99 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
100 1 my ($self, $response) = @_;
101 return Twilio::Rest::Api::V2010::Account::Call::PaymentInstance->new(
102 $self->{version}, $response->get_content,
103 $self->{solution}{account_sid},
104 $self->{solution}{call_sid},
105 $self->{solution}{sid}
106 1 );
107 }
108  
109 package Twilio::Rest::Api::V2010::Account::Call::PaymentInstance;
110  
111 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
112  
113 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
114  
115 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
116 2 my ($class, $version, $payload, $account_sid, $call_sid, $sid) = @_;
117 2 my $self = $class->SUPER::new($version, $payload);
118 $self->{solution} =
119 2 ▶ { account_sid => $account_sid, call_sid => $call_sid, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
110
MC/DC0%0/2
$sid // $self->{"properties"}{"sid"}
$sid $self->{"properties"}{"sid"}
Truth table66%2/3
A // B
A= $sidB= $self->{"properties"}{"sid"}
ABresult
1X1
011
000
120 2 return $self;
121 }
122  
123 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
124 0 my ($self, @arguments) = @_;
125 0 return $self->_context->update(@arguments);
126 }
127  
128 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
129 0 my ($self) = @_;
130 return Twilio::Rest::Api::V2010::Account::Call::PaymentContext->new(
131 $self->{version},
132 $self->{solution}{account_sid},
133 $self->{solution}{call_sid},
134 $self->{solution}{sid}
135 0 );
136 }
137  
138 2 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
139 2 ▶sub call_sid { return $_[0]{properties}{call_sid} }
Subroutine call_sid: called CC=1 SCAR=0.0
140 2 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
141 2 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
142 2 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
143 2 ▶sub uri { return $_[0]{properties}{uri} }
Subroutine uri: called CC=1 SCAR=0.0
144  
145 2 1;
146  
147 __END__
« Twilio/Rest/PreviewIam/Versionless/Organization/User.pm ↑ Summary Twilio/Rest/Events/V1/Sink.pm »