line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::CyberSource::Request; |
2
|
8
|
|
|
8
|
|
4792
|
use 5.010; |
|
8
|
|
|
|
|
20
|
|
3
|
8
|
|
|
8
|
|
33
|
use strict; |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
162
|
|
4
|
8
|
|
|
8
|
|
26
|
use warnings; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
189
|
|
5
|
8
|
|
|
8
|
|
27
|
use namespace::autoclean; |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
45
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.010007'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
8
|
|
|
8
|
|
518
|
use Moose; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
39
|
|
10
|
|
|
|
|
|
|
extends 'Business::CyberSource::Message'; |
11
|
|
|
|
|
|
|
with qw( |
12
|
|
|
|
|
|
|
MooseX::RemoteHelper::CompositeSerialization |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
8
|
|
|
8
|
|
33948
|
use MooseX::Types::CyberSource qw( PurchaseTotals Service Items ); |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
50
|
|
16
|
|
|
|
|
|
|
|
17
|
8
|
|
|
8
|
|
48915
|
use Module::Runtime qw( use_module ); |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
62
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our @CARP_NOT = ( 'Class::MOP::Method::Wrapped', __PACKAGE__ ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
before serialize => sub { ## no critic qw( Subroutines::RequireFinalReturn ) |
22
|
|
|
|
|
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
if ( ! $self->has_total && ( ! $self->has_items || $self->items_is_empty ) ) { |
25
|
|
|
|
|
|
|
die ## no critic ( ErrorHandling::RequireCarping ) |
26
|
|
|
|
|
|
|
use_module('Business::CyberSource::Exception::ItemsOrTotal')->new; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub add_item { |
31
|
0
|
|
|
0
|
1
|
0
|
my ( $self, $args ) = @_; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
0
|
my $item; |
34
|
0
|
0
|
0
|
|
|
0
|
unless ( blessed $args |
35
|
|
|
|
|
|
|
&& $args->isa( 'Business::CyberSource::RequestPart::Item' ) |
36
|
|
|
|
|
|
|
) { |
37
|
0
|
|
|
|
|
0
|
$item |
38
|
|
|
|
|
|
|
= use_module('Business::CyberSource::RequestPart::Item') |
39
|
|
|
|
|
|
|
->new( $args ) |
40
|
|
|
|
|
|
|
; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
else { |
43
|
0
|
|
|
|
|
0
|
$item = $args; |
44
|
|
|
|
|
|
|
} |
45
|
0
|
0
|
|
|
|
0
|
$self->items( [ ] ) if ! $self->has_items; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
0
|
return $self->_push_item( $item ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub _build_service { |
51
|
1
|
|
|
1
|
|
2903
|
return use_module('Business::CyberSource::RequestPart::Service')->new; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
has comments => ( |
55
|
|
|
|
|
|
|
remote_name => 'comments', |
56
|
|
|
|
|
|
|
isa => 'Str', |
57
|
|
|
|
|
|
|
traits => ['SetOnce'], |
58
|
|
|
|
|
|
|
is => 'rw', |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
has service => ( |
62
|
|
|
|
|
|
|
isa => Service, |
63
|
|
|
|
|
|
|
is => 'ro', |
64
|
|
|
|
|
|
|
lazy_build => 1, |
65
|
|
|
|
|
|
|
required => 1, |
66
|
|
|
|
|
|
|
coerce => 1, |
67
|
|
|
|
|
|
|
reader => undef, |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
has purchase_totals => ( |
71
|
|
|
|
|
|
|
isa => PurchaseTotals, |
72
|
|
|
|
|
|
|
remote_name => 'purchaseTotals', |
73
|
|
|
|
|
|
|
is => 'ro', |
74
|
|
|
|
|
|
|
required => 1, |
75
|
|
|
|
|
|
|
coerce => 1, |
76
|
|
|
|
|
|
|
handles => [qw( total has_total )], |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
has items => ( |
80
|
|
|
|
|
|
|
isa => Items, |
81
|
|
|
|
|
|
|
remote_name => 'item', |
82
|
|
|
|
|
|
|
predicate => 'has_items', |
83
|
|
|
|
|
|
|
is => 'rw', |
84
|
|
|
|
|
|
|
traits => ['Array'], |
85
|
|
|
|
|
|
|
coerce => 1, |
86
|
|
|
|
|
|
|
handles => { |
87
|
|
|
|
|
|
|
items_is_empty => 'is_empty', |
88
|
|
|
|
|
|
|
next_item => [ natatime => 1 ], |
89
|
|
|
|
|
|
|
list_items => 'elements', |
90
|
|
|
|
|
|
|
_push_item => 'push', |
91
|
|
|
|
|
|
|
}, |
92
|
|
|
|
|
|
|
serializer => sub { |
93
|
|
|
|
|
|
|
my ( $attr, $instance ) = @_; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
my $items = $attr->get_value( $instance ); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
my $i = 0; |
98
|
|
|
|
|
|
|
my @serialized |
99
|
|
|
|
|
|
|
= map { ## no critic ( BuiltinFunctions::ProhibitComplexMappings ) |
100
|
|
|
|
|
|
|
my $item = $_->serialize; |
101
|
|
|
|
|
|
|
$item->{id} = $i; |
102
|
|
|
|
|
|
|
$i++; |
103
|
|
|
|
|
|
|
$item |
104
|
|
|
|
|
|
|
} @{ $items }; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
return \@serialized; |
107
|
|
|
|
|
|
|
}, |
108
|
|
|
|
|
|
|
); |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
has '+http_trace' => ( |
111
|
|
|
|
|
|
|
is => 'rw', |
112
|
|
|
|
|
|
|
init_arg => undef |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
116
|
|
|
|
|
|
|
1; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# ABSTRACT: Abstract Request Class |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
__END__ |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=pod |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=encoding UTF-8 |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 NAME |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Business::CyberSource::Request - Abstract Request Class |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 VERSION |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
version 0.010007 |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 DESCRIPTION |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
extends L<Business::CyberSource::Message> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Here are the provided Request subclasses. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=over |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item * L<Authorization|Business::CyberSource::Request::Authorization> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item * L<AuthReversal|Business::CyberSource::Request::AuthReversal> |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item * L<Capture|Business::CyberSource::Request::Capture> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * L<Follow-On Credit|Business::CyberSource::Request::FollowOnCredit> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item * L<Stand Alone Credit|Business::CyberSource::Request::StandAloneCredit> |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * L<DCC|Business::CyberSource::Request::DCC> |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item * L<Sale|Business::CyberSource::Request::Sale> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=back |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
I<note:> You can use the L<Business:CyberSource::Request::Credit> class but, |
159
|
|
|
|
|
|
|
it requires traits to be applied depending on the type of request you need, |
160
|
|
|
|
|
|
|
and thus does not currently work with the factory. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 EXTENDS |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
L<Business::CyberSource::Message> |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 WITH |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=over |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item L<MooseX::RemoteHelper::CompositeSerialization> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=back |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 METHODS |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head2 serialize |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
returns a hashref suitable for passing to L<XML::Compile::SOAP> |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head2 add_item |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Add an L<Item|Business::CyberSource::RequestPart::Item> to L<items|/"items">. |
183
|
|
|
|
|
|
|
Accepts an item object or a hashref to construct an item object. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
an array of L<Items|MooseX::Types::CyberSource/"Items"> |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head2 reference_code |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Merchant-generated order reference or tracking number. CyberSource recommends |
192
|
|
|
|
|
|
|
that you send a unique value for each transaction so that you can perform |
193
|
|
|
|
|
|
|
meaningful searches for the transaction. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head2 service |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
L<Business::CyberSource::RequestPart::Service> |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head2 purchase_totals |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
L<Business::CyberSource::RequestPart::PurchaseTotals> |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head2 items |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
An array of L<Business::CyberSource::RequestPart::Item> |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head2 comments |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Comment Field |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=for Pod::Coverage BUILD |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head1 BUGS |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
216
|
|
|
|
|
|
|
https://github.com/xenoterracide/business-cybersource/issues |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
219
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
220
|
|
|
|
|
|
|
feature. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head1 AUTHOR |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Caleb Cushing <xenoterracide@gmail.com> |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
This software is Copyright (c) 2016 by Caleb Cushing <xenoterracide@gmail.com>. |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
This is free software, licensed under: |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=cut |