| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Business::AuthorizeNet::CIM; |
|
2
|
|
|
|
|
|
|
$Business::AuthorizeNet::CIM::VERSION = '0.19'; |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: Authorize.Net Customer Information Manager (CIM) Web Services API |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
284243
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
45
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
70
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Carp qw/croak/; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
74
|
|
|
9
|
1
|
|
|
1
|
|
1124
|
use LWP::UserAgent; |
|
|
1
|
|
|
|
|
79347
|
|
|
|
1
|
|
|
|
|
52
|
|
|
10
|
1
|
|
|
1
|
|
818
|
use XML::Writer; |
|
|
1
|
|
|
|
|
18942
|
|
|
|
1
|
|
|
|
|
52
|
|
|
11
|
1
|
|
|
1
|
|
1007
|
use XML::Simple 'XMLin'; |
|
|
1
|
|
|
|
|
13454
|
|
|
|
1
|
|
|
|
|
10
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
|
14
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
15
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# validate |
|
18
|
0
|
0
|
|
|
|
|
$args->{login} or croak 'login is required'; |
|
19
|
0
|
0
|
|
|
|
|
$args->{transactionKey} or croak 'transactionKey is required'; |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
0
|
0
|
|
|
|
if ($args->{test_mode} || $args->{test_host_only}) { |
|
22
|
0
|
|
|
|
|
|
$args->{url} = 'https://apitest.authorize.net/xml/v1/request.api'; |
|
23
|
|
|
|
|
|
|
} else { |
|
24
|
0
|
|
|
|
|
|
$args->{url} = 'https://api2.authorize.net/xml/v1/request.api'; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
unless ($args->{ua}) { |
|
28
|
0
|
|
0
|
|
|
|
my $ua_args = delete $args->{ua_args} || {}; |
|
29
|
0
|
|
|
|
|
|
$args->{ua} = LWP::UserAgent->new(%$ua_args); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
bless $args, $class; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub createTransactionRequest { |
|
36
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
37
|
0
|
|
|
|
|
|
my $trans_type = shift; |
|
38
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $xml; |
|
41
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
42
|
0
|
|
|
|
|
|
$writer->startTag('createTransactionRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
43
|
0
|
|
|
|
|
|
$self->_addAuthentication($writer); |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
|
$writer->dataElement('refId', $args->{refId}) if defined $args->{refId}; |
|
46
|
0
|
|
|
|
|
|
$writer->startTag('transactionRequest'); |
|
47
|
0
|
|
|
|
|
|
$writer->dataElement('transactionType', $trans_type); |
|
48
|
0
|
0
|
|
|
|
|
$writer->dataElement('amount', $args->{amount}) if exists $args->{amount}; |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
if (exists $args->{opaqueData}) { |
|
51
|
0
|
|
|
|
|
|
$writer->startTag('payment'); |
|
52
|
0
|
|
|
|
|
|
$writer->startTag('opaqueData'); |
|
53
|
0
|
|
|
|
|
|
foreach my $k (qw/dataDescriptor dataValue/) { |
|
54
|
0
|
|
|
|
|
|
$writer->dataElement($k, $args->{opaqueData}->{$k}); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
0
|
|
|
|
|
|
$writer->endTag('opaqueData'); |
|
57
|
0
|
|
|
|
|
|
$writer->endTag('payment'); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
0
|
0
|
|
|
|
if (exists $args->{customerProfileId} && exists $args->{customerPaymentProfileId}) { |
|
61
|
0
|
|
|
|
|
|
$writer->startTag('profile'); |
|
62
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $args->{customerProfileId}); |
|
63
|
0
|
|
|
|
|
|
$writer->startTag('paymentProfile'); |
|
64
|
0
|
|
|
|
|
|
$writer->dataElement('paymentProfileId', $args->{customerPaymentProfileId}); |
|
65
|
0
|
|
|
|
|
|
$writer->endTag('paymentProfile'); |
|
66
|
0
|
|
|
|
|
|
$writer->endTag('profile'); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
if (exists $args->{creditCard}) { |
|
70
|
0
|
|
|
|
|
|
$writer->startTag('payment'); |
|
71
|
0
|
|
|
|
|
|
$writer->startTag('creditCard'); |
|
72
|
0
|
|
|
|
|
|
foreach my $k ('cardNumber', 'expirationDate', 'cardCode') { |
|
73
|
|
|
|
|
|
|
$writer->dataElement($k, $args->{creditCard}->{$k}) |
|
74
|
0
|
0
|
|
|
|
|
if exists $args->{creditCard}->{$k}; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
0
|
|
|
|
|
|
$writer->endTag('creditCard'); |
|
77
|
0
|
|
|
|
|
|
$writer->endTag('payment'); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
0
|
0
|
|
|
|
|
if (exists $args->{bankAccount}) { |
|
80
|
0
|
|
|
|
|
|
$writer->startTag('payment'); |
|
81
|
0
|
|
|
|
|
|
$writer->startTag('bankAccount'); |
|
82
|
0
|
|
|
|
|
|
foreach my $k ('accountType', 'routingNumber', 'accountNumber', 'nameOnAccount', 'echeckType', 'bankName', 'checkNumber') { |
|
83
|
0
|
|
|
|
|
|
$writer->dataElement($k, $args->{bankAccount}->{$k}); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
0
|
|
|
|
|
|
$writer->endTag('bankAccount'); |
|
86
|
0
|
|
|
|
|
|
$writer->endTag('payment'); |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
$writer->dataElement('refTransId', $args->{refTransId}) |
|
90
|
|
|
|
|
|
|
if (exists $args->{refTransId} |
|
91
|
0
|
0
|
0
|
|
|
|
and ($trans_type eq 'priorAuthCaptureTransaction' or $trans_type eq 'refundTransaction' or $trans_type eq 'voidTransaction')); |
|
|
|
|
0
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
0
|
0
|
|
|
|
|
if (exists $args->{order}) { |
|
94
|
0
|
|
|
|
|
|
$writer->startTag('order'); |
|
95
|
0
|
|
|
|
|
|
foreach my $k ('invoiceNumber', 'description') { |
|
96
|
|
|
|
|
|
|
$writer->dataElement($k, $args->{order}->{$k}) |
|
97
|
0
|
0
|
|
|
|
|
if exists $args->{order}->{$k}; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
0
|
|
|
|
|
|
$writer->endTag('order'); |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
0
|
0
|
|
|
|
|
if (exists $args->{lineItems}) { |
|
103
|
0
|
|
|
|
|
|
$writer->startTag('lineItems'); |
|
104
|
0
|
0
|
|
|
|
|
my @lineItems = (ref($args->{lineItems}) eq 'ARRAY') ? @{$args->{lineItems}} : ($args->{lineItems}); |
|
|
0
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
foreach my $lineItem (@lineItems) { |
|
106
|
0
|
|
|
|
|
|
$writer->startTag('lineItem'); |
|
107
|
0
|
|
|
|
|
|
foreach my $k ('itemId', 'name', 'description', 'quantity', 'unitPrice', 'taxable') { |
|
108
|
|
|
|
|
|
|
$writer->dataElement($k, $lineItem->{$k}) |
|
109
|
0
|
0
|
|
|
|
|
if exists $lineItem->{$k}; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
0
|
|
|
|
|
|
$writer->endTag('lineItem'); |
|
112
|
|
|
|
|
|
|
} |
|
113
|
0
|
|
|
|
|
|
$writer->endTag('lineItems'); |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
foreach my $type ('tax', 'shipping', 'duty') { |
|
117
|
0
|
0
|
|
|
|
|
next unless exists $args->{$type}; |
|
118
|
0
|
|
|
|
|
|
$writer->startTag($type); |
|
119
|
0
|
|
|
|
|
|
foreach my $k ('amount', 'name', 'description') { |
|
120
|
|
|
|
|
|
|
$writer->dataElement($k, $args->{$type}->{$k}) |
|
121
|
0
|
0
|
|
|
|
|
if exists $args->{$type}->{$k}; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
0
|
|
|
|
|
|
$writer->endTag($type); |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
0
|
0
|
|
|
|
|
$writer->dataElement('poNumber', $args->{poNumber}) if exists $args->{poNumber}; |
|
127
|
0
|
0
|
|
|
|
|
$writer->dataElement('taxExempt', $args->{taxExempt}) if exists $args->{taxExempt}; |
|
128
|
|
|
|
|
|
|
|
|
129
|
0
|
0
|
|
|
|
|
if (exists $args->{customerId}) { |
|
130
|
0
|
|
|
|
|
|
$writer->startTag('customer'); |
|
131
|
0
|
|
|
|
|
|
$writer->dataElement('id', $args->{customerId}); |
|
132
|
0
|
|
|
|
|
|
$writer->endTag('customer'); |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
my @flds = ('firstName', 'lastName', 'company', 'address', 'city', 'state', 'zip', 'country'); |
|
136
|
0
|
0
|
|
|
|
|
my $bill_addr = exists $args->{billTo} ? $args->{billTo} : $args; |
|
137
|
0
|
0
|
|
|
|
|
if (grep { exists $bill_addr->{$_} } @flds) { |
|
|
0
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
$writer->startTag('billTo'); |
|
139
|
0
|
|
|
|
|
|
foreach my $k (@flds) { |
|
140
|
|
|
|
|
|
|
$writer->dataElement($k, $bill_addr->{$k}) |
|
141
|
0
|
0
|
|
|
|
|
if exists $bill_addr->{$k}; |
|
142
|
|
|
|
|
|
|
} |
|
143
|
0
|
|
|
|
|
|
$writer->endTag('billTo'); |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
0
|
0
|
|
|
|
|
my $ship_addr = exists $args->{shipTo} ? $args->{shipTo} : $args; |
|
147
|
0
|
0
|
|
|
|
|
if (grep { exists $ship_addr->{$_} } @flds) { |
|
|
0
|
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
|
$writer->startTag('shipTo'); |
|
149
|
0
|
|
|
|
|
|
foreach my $k (@flds) { |
|
150
|
|
|
|
|
|
|
$writer->dataElement($k, $ship_addr->{$k}) |
|
151
|
0
|
0
|
|
|
|
|
if exists $ship_addr->{$k}; |
|
152
|
|
|
|
|
|
|
} |
|
153
|
0
|
|
|
|
|
|
$writer->endTag('shipTo'); |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
|
|
156
|
0
|
0
|
|
|
|
|
$writer->dataElement('customerIP', $args->{customerIP}) if exists $args->{customerIP}; |
|
157
|
|
|
|
|
|
|
|
|
158
|
0
|
0
|
|
|
|
|
if (exists $args->{transactionSettings}) { |
|
159
|
0
|
|
|
|
|
|
$writer->startTag('transactionSettings'); |
|
160
|
0
|
|
|
|
|
|
foreach my $setting (keys %{$args->{transactionSettings}}) { |
|
|
0
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
$writer->startTag('setting'); |
|
162
|
0
|
|
|
|
|
|
$writer->dataElement('settingName', $setting); |
|
163
|
0
|
|
|
|
|
|
$writer->dataElement('settingValue', $args->{transactionSettings}{$setting}); |
|
164
|
0
|
|
|
|
|
|
$writer->endTag('setting'); |
|
165
|
|
|
|
|
|
|
} |
|
166
|
0
|
|
|
|
|
|
$writer->endTag('transactionSettings'); |
|
167
|
|
|
|
|
|
|
} |
|
168
|
|
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
$writer->endTag('transactionRequest'); |
|
170
|
0
|
|
|
|
|
|
$writer->endTag('createTransactionRequest'); |
|
171
|
0
|
|
|
|
|
|
$writer->end; |
|
172
|
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
sub _need_payment_profiles_section { |
|
177
|
0
|
|
|
0
|
|
|
my ($self, $args) = @_; |
|
178
|
|
|
|
|
|
|
return |
|
179
|
|
|
|
|
|
|
exists $args->{billTo} |
|
180
|
|
|
|
|
|
|
|| exists $args->{creditCard} |
|
181
|
|
|
|
|
|
|
|| exists $args->{bankAccount} |
|
182
|
|
|
|
|
|
|
|| exists $args->{opaqueData} |
|
183
|
0
|
|
0
|
|
|
|
|| ($args->{use_shipToList_as_billTo} and $args->{shipToList}); |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub createCustomerProfile { |
|
187
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
188
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
189
|
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
|
my $xml; |
|
191
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
192
|
0
|
|
|
|
|
|
$writer->startTag('createCustomerProfileRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
193
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
194
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
195
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
196
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
197
|
0
|
0
|
|
|
|
|
$writer->dataElement('refId', $args->{refId}) if exists $args->{refId}; |
|
198
|
0
|
|
|
|
|
|
$writer->startTag('profile'); |
|
199
|
|
|
|
|
|
|
|
|
200
|
0
|
|
|
|
|
|
foreach my $k ('merchantCustomerId', 'description', 'email') { |
|
201
|
|
|
|
|
|
|
$writer->dataElement($k, $args->{$k}) |
|
202
|
0
|
0
|
|
|
|
|
if exists $args->{$k}; |
|
203
|
|
|
|
|
|
|
} |
|
204
|
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
|
my @flds = qw( |
|
206
|
|
|
|
|
|
|
firstName lastName company address city state zip country |
|
207
|
|
|
|
|
|
|
phoneNumber faxNumber |
|
208
|
|
|
|
|
|
|
); |
|
209
|
|
|
|
|
|
|
|
|
210
|
0
|
|
|
|
|
|
my $need_payment_profiles = $self->_need_payment_profiles_section($args); |
|
211
|
0
|
0
|
|
|
|
|
if ($need_payment_profiles) { |
|
212
|
0
|
|
|
|
|
|
$writer->startTag('paymentProfiles'); |
|
213
|
0
|
0
|
|
|
|
|
$writer->dataElement('customerType', $args->{'customerType'}) if exists $args->{'customerType'}; |
|
214
|
|
|
|
|
|
|
|
|
215
|
0
|
0
|
0
|
|
|
|
if (exists $args->{billTo} or ($args->{use_shipToList_as_billTo} and $args->{shipToList})) { |
|
|
|
|
0
|
|
|
|
|
|
216
|
0
|
0
|
|
|
|
|
my $addr = exists $args->{billTo} ? $args->{billTo} : $args->{shipToList}; |
|
217
|
0
|
|
|
|
|
|
$writer->startTag('billTo'); |
|
218
|
0
|
|
|
|
|
|
foreach my $k (@flds) { |
|
219
|
|
|
|
|
|
|
$writer->dataElement($k, $addr->{$k}) |
|
220
|
0
|
0
|
|
|
|
|
if exists $addr->{$k}; |
|
221
|
|
|
|
|
|
|
} |
|
222
|
0
|
|
|
|
|
|
$writer->endTag('billTo'); |
|
223
|
|
|
|
|
|
|
} |
|
224
|
|
|
|
|
|
|
|
|
225
|
0
|
|
|
|
|
|
$writer->startTag('payment'); |
|
226
|
|
|
|
|
|
|
|
|
227
|
0
|
0
|
|
|
|
|
if (exists $args->{creditCard}) { |
|
228
|
0
|
|
|
|
|
|
$writer->startTag('creditCard'); |
|
229
|
0
|
|
|
|
|
|
foreach my $k ('cardNumber', 'expirationDate', 'cardCode') { |
|
230
|
|
|
|
|
|
|
$writer->dataElement($k, $args->{creditCard}->{$k}) |
|
231
|
0
|
0
|
|
|
|
|
if exists $args->{creditCard}->{$k}; |
|
232
|
|
|
|
|
|
|
} |
|
233
|
0
|
|
|
|
|
|
$writer->endTag('creditCard'); |
|
234
|
|
|
|
|
|
|
} |
|
235
|
0
|
0
|
|
|
|
|
if (exists $args->{bankAccount}) { |
|
236
|
0
|
|
|
|
|
|
$writer->startTag('bankAccount'); |
|
237
|
0
|
|
|
|
|
|
foreach my $k ('accountType', 'routingNumber', 'accountNumber', 'nameOnAccount', 'echeckType', 'bankName') { |
|
238
|
0
|
|
|
|
|
|
$writer->dataElement($k, $args->{bankAccount}->{$k}); |
|
239
|
|
|
|
|
|
|
} |
|
240
|
0
|
|
|
|
|
|
$writer->endTag('bankAccount'); |
|
241
|
|
|
|
|
|
|
} |
|
242
|
0
|
0
|
|
|
|
|
if (exists $args->{opaqueData}) { |
|
243
|
0
|
|
|
|
|
|
$writer->startTag('opaqueData'); |
|
244
|
0
|
|
|
|
|
|
foreach my $k (qw/dataDescriptor dataValue/) { |
|
245
|
0
|
|
|
|
|
|
$writer->dataElement($k, $args->{opaqueData}->{$k}); |
|
246
|
|
|
|
|
|
|
} |
|
247
|
0
|
|
|
|
|
|
$writer->endTag('opaqueData'); |
|
248
|
|
|
|
|
|
|
} |
|
249
|
|
|
|
|
|
|
|
|
250
|
0
|
|
|
|
|
|
$writer->endTag('payment'); |
|
251
|
0
|
|
|
|
|
|
$writer->endTag('paymentProfiles'); |
|
252
|
|
|
|
|
|
|
} |
|
253
|
|
|
|
|
|
|
|
|
254
|
0
|
0
|
0
|
|
|
|
if (exists $args->{shipToList} or ($args->{use_billTo_as_shipToList} and $args->{billTo})) { |
|
|
|
|
0
|
|
|
|
|
|
255
|
0
|
0
|
|
|
|
|
my $addr = exists $args->{shipToList} ? $args->{shipToList} : $args->{billTo}; |
|
256
|
0
|
|
|
|
|
|
$writer->startTag('shipToList'); |
|
257
|
0
|
|
|
|
|
|
foreach my $k (@flds) { |
|
258
|
|
|
|
|
|
|
$writer->dataElement($k, $addr->{$k}) |
|
259
|
0
|
0
|
|
|
|
|
if exists $addr->{$k}; |
|
260
|
|
|
|
|
|
|
} |
|
261
|
0
|
|
|
|
|
|
$writer->endTag('shipToList'); |
|
262
|
|
|
|
|
|
|
} |
|
263
|
|
|
|
|
|
|
|
|
264
|
0
|
|
|
|
|
|
$writer->endTag('profile'); |
|
265
|
0
|
0
|
|
|
|
|
if ($need_payment_profiles) { |
|
266
|
0
|
0
|
|
|
|
|
if ($self->{test_mode}) { |
|
|
|
0
|
|
|
|
|
|
|
267
|
0
|
|
|
|
|
|
$writer->dataElement('validationMode', 'testMode'); |
|
268
|
|
|
|
|
|
|
} elsif ($args->{validationMode}) { |
|
269
|
0
|
|
|
|
|
|
$writer->dataElement('validationMode', $args->{validationMode}); |
|
270
|
|
|
|
|
|
|
} else { |
|
271
|
0
|
|
|
|
|
|
$writer->dataElement('validationMode', 'liveMode'); |
|
272
|
|
|
|
|
|
|
} |
|
273
|
|
|
|
|
|
|
} |
|
274
|
0
|
|
|
|
|
|
$writer->endTag('createCustomerProfileRequest'); |
|
275
|
0
|
|
|
|
|
|
$writer->end; |
|
276
|
|
|
|
|
|
|
|
|
277
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
278
|
|
|
|
|
|
|
} |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
sub createCustomerPaymentProfileRequest { |
|
281
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
282
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
283
|
|
|
|
|
|
|
|
|
284
|
0
|
|
|
|
|
|
my $xml; |
|
285
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
286
|
0
|
|
|
|
|
|
$writer->startTag('createCustomerPaymentProfileRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
287
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
288
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
289
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
290
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
291
|
0
|
0
|
|
|
|
|
$writer->dataElement('refId', $args->{refId}) if exists $args->{refId}; |
|
292
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $args->{customerProfileId}); |
|
293
|
0
|
|
|
|
|
|
$writer->startTag('paymentProfile'); |
|
294
|
0
|
0
|
|
|
|
|
$writer->dataElement('customerType', $args->{'customerType'}) if exists $args->{'customerType'}; |
|
295
|
|
|
|
|
|
|
|
|
296
|
0
|
|
|
|
|
|
my @flds = ('firstName', 'lastName', 'company', 'address', 'city', 'state', 'zip', 'country', 'phoneNumber', 'faxNumber'); |
|
297
|
0
|
0
|
|
|
|
|
my $addr = exists $args->{billTo} ? $args->{billTo} : $args; |
|
298
|
0
|
0
|
|
|
|
|
if (grep { exists $addr->{$_} } @flds) { |
|
|
0
|
|
|
|
|
|
|
|
299
|
0
|
|
|
|
|
|
$writer->startTag('billTo'); |
|
300
|
0
|
|
|
|
|
|
foreach my $k (@flds) { |
|
301
|
|
|
|
|
|
|
$writer->dataElement($k, $addr->{$k}) |
|
302
|
0
|
0
|
|
|
|
|
if exists $addr->{$k}; |
|
303
|
|
|
|
|
|
|
} |
|
304
|
0
|
|
|
|
|
|
$writer->endTag('billTo'); |
|
305
|
|
|
|
|
|
|
} |
|
306
|
|
|
|
|
|
|
|
|
307
|
0
|
|
|
|
|
|
$writer->startTag('payment'); |
|
308
|
|
|
|
|
|
|
|
|
309
|
0
|
0
|
|
|
|
|
if (exists $args->{creditCard}) { |
|
310
|
0
|
|
|
|
|
|
$writer->startTag('creditCard'); |
|
311
|
0
|
|
|
|
|
|
foreach my $k ('cardNumber', 'expirationDate', 'cardCode') { |
|
312
|
|
|
|
|
|
|
$writer->dataElement($k, $args->{creditCard}->{$k}) |
|
313
|
0
|
0
|
|
|
|
|
if exists $args->{creditCard}->{$k}; |
|
314
|
|
|
|
|
|
|
} |
|
315
|
0
|
|
|
|
|
|
$writer->endTag('creditCard'); |
|
316
|
|
|
|
|
|
|
} |
|
317
|
0
|
0
|
|
|
|
|
if (exists $args->{bankAccount}) { |
|
318
|
0
|
|
|
|
|
|
$writer->startTag('bankAccount'); |
|
319
|
0
|
|
|
|
|
|
foreach my $k ('accountType', 'routingNumber', 'accountNumber', 'nameOnAccount', 'echeckType', 'bankName') { |
|
320
|
0
|
|
|
|
|
|
$writer->dataElement($k, $args->{bankAccount}->{$k}); |
|
321
|
|
|
|
|
|
|
} |
|
322
|
0
|
|
|
|
|
|
$writer->endTag('bankAccount'); |
|
323
|
|
|
|
|
|
|
} |
|
324
|
0
|
0
|
|
|
|
|
if (exists $args->{opaqueData}) { |
|
325
|
0
|
|
|
|
|
|
$writer->startTag('opaqueData'); |
|
326
|
0
|
|
|
|
|
|
foreach my $k (qw/dataDescriptor dataValue/) { |
|
327
|
0
|
|
|
|
|
|
$writer->dataElement($k, $args->{opaqueData}->{$k}); |
|
328
|
|
|
|
|
|
|
} |
|
329
|
0
|
|
|
|
|
|
$writer->endTag('opaqueData'); |
|
330
|
|
|
|
|
|
|
} |
|
331
|
|
|
|
|
|
|
|
|
332
|
0
|
|
|
|
|
|
$writer->endTag('payment'); |
|
333
|
0
|
|
|
|
|
|
$writer->endTag('paymentProfile'); |
|
334
|
|
|
|
|
|
|
|
|
335
|
0
|
0
|
|
|
|
|
if ($self->{test_mode}) { |
|
|
|
0
|
|
|
|
|
|
|
336
|
0
|
|
|
|
|
|
$writer->dataElement('validationMode', 'testMode'); |
|
337
|
|
|
|
|
|
|
} elsif ($args->{validationMode}) { |
|
338
|
0
|
|
|
|
|
|
$writer->dataElement('validationMode', $args->{validationMode}); |
|
339
|
|
|
|
|
|
|
} else { |
|
340
|
0
|
|
|
|
|
|
$writer->dataElement('validationMode', 'liveMode'); |
|
341
|
|
|
|
|
|
|
} |
|
342
|
0
|
|
|
|
|
|
$writer->endTag('createCustomerPaymentProfileRequest'); |
|
343
|
0
|
|
|
|
|
|
$writer->end; |
|
344
|
|
|
|
|
|
|
|
|
345
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
346
|
|
|
|
|
|
|
} |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
sub createCustomerShippingAddressRequest { |
|
349
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
350
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
351
|
|
|
|
|
|
|
|
|
352
|
0
|
|
|
|
|
|
my $xml; |
|
353
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
354
|
0
|
|
|
|
|
|
$writer->startTag('createCustomerShippingAddressRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
355
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
356
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
357
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
358
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
359
|
0
|
0
|
|
|
|
|
$writer->dataElement('refId', $args->{refId}) if exists $args->{refId}; |
|
360
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $args->{customerProfileId}); |
|
361
|
0
|
|
|
|
|
|
$writer->startTag('address'); |
|
362
|
|
|
|
|
|
|
|
|
363
|
0
|
|
|
|
|
|
my @flds = ('firstName', 'lastName', 'company', 'address', 'city', 'state', 'zip', 'country', 'phoneNumber', 'faxNumber'); |
|
364
|
0
|
0
|
|
|
|
|
my $addr = exists $args->{shipToList} ? $args->{shipToList} : $args; |
|
365
|
0
|
|
|
|
|
|
foreach my $k (@flds) { |
|
366
|
|
|
|
|
|
|
$writer->dataElement($k, $addr->{$k}) |
|
367
|
0
|
0
|
|
|
|
|
if exists $addr->{$k}; |
|
368
|
|
|
|
|
|
|
} |
|
369
|
|
|
|
|
|
|
|
|
370
|
0
|
|
|
|
|
|
$writer->endTag('address'); |
|
371
|
0
|
|
|
|
|
|
$writer->endTag('createCustomerShippingAddressRequest'); |
|
372
|
0
|
|
|
|
|
|
$writer->end; |
|
373
|
|
|
|
|
|
|
|
|
374
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
375
|
|
|
|
|
|
|
} |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
sub createCustomerProfileTransaction { |
|
378
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
379
|
0
|
|
|
|
|
|
my $trans_type = shift; |
|
380
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
381
|
|
|
|
|
|
|
|
|
382
|
0
|
|
|
|
|
|
my $xml; |
|
383
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
384
|
0
|
|
|
|
|
|
$writer->startTag('createCustomerProfileTransactionRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
385
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
386
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
387
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
388
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
389
|
0
|
0
|
|
|
|
|
$writer->dataElement('refId', $args->{refId}) if exists $args->{refId}; |
|
390
|
0
|
|
|
|
|
|
$writer->startTag('transaction'); |
|
391
|
0
|
|
|
|
|
|
$writer->startTag($trans_type); # profileTransAuthOnly, profileTransPriorAuthCapture etc |
|
392
|
0
|
0
|
|
|
|
|
$writer->dataElement('amount', $args->{amount}) if exists $args->{amount}; |
|
393
|
|
|
|
|
|
|
|
|
394
|
0
|
|
|
|
|
|
foreach my $type ('tax', 'shipping', 'duty') { |
|
395
|
0
|
0
|
|
|
|
|
next unless exists $args->{$type}; |
|
396
|
0
|
|
|
|
|
|
$writer->startTag($type); |
|
397
|
0
|
|
|
|
|
|
foreach my $k ('amount', 'name', 'description') { |
|
398
|
|
|
|
|
|
|
$writer->dataElement($k, $args->{$type}->{$k}) |
|
399
|
0
|
0
|
|
|
|
|
if exists $args->{$type}->{$k}; |
|
400
|
|
|
|
|
|
|
} |
|
401
|
0
|
|
|
|
|
|
$writer->endTag($type); |
|
402
|
|
|
|
|
|
|
} |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
# lineItems |
|
405
|
0
|
0
|
|
|
|
|
if (exists $args->{lineItems}) { |
|
406
|
0
|
0
|
|
|
|
|
my @lineItems = (ref($args->{lineItems}) eq 'ARRAY') ? @{$args->{lineItems}} : ($args->{lineItems}); |
|
|
0
|
|
|
|
|
|
|
|
407
|
0
|
|
|
|
|
|
foreach my $lineItem (@lineItems) { |
|
408
|
0
|
|
|
|
|
|
$writer->startTag('lineItems'); |
|
409
|
0
|
|
|
|
|
|
foreach my $k ('itemId', 'name', 'description', 'quantity', 'unitPrice', 'taxable') { |
|
410
|
|
|
|
|
|
|
$writer->dataElement($k, $lineItem->{$k}) |
|
411
|
0
|
0
|
|
|
|
|
if exists $lineItem->{$k}; |
|
412
|
|
|
|
|
|
|
} |
|
413
|
0
|
|
|
|
|
|
$writer->endTag('lineItems'); |
|
414
|
|
|
|
|
|
|
} |
|
415
|
|
|
|
|
|
|
} |
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $args->{customerProfileId}) |
|
418
|
0
|
0
|
|
|
|
|
if $args->{customerProfileId}; |
|
419
|
|
|
|
|
|
|
$writer->dataElement('customerPaymentProfileId', $args->{customerPaymentProfileId}) |
|
420
|
0
|
0
|
|
|
|
|
if $args->{customerPaymentProfileId}; |
|
421
|
|
|
|
|
|
|
$writer->dataElement('customerShippingAddressId', $args->{customerShippingAddressId}) |
|
422
|
0
|
0
|
|
|
|
|
if $args->{customerShippingAddressId}; |
|
423
|
|
|
|
|
|
|
|
|
424
|
0
|
0
|
|
|
|
|
if ($trans_type eq 'profileTransRefund') { |
|
425
|
0
|
|
|
|
|
|
foreach my $k ('creditCardNumberMasked', 'bankRoutingNumberMasked', 'bankAccountNumberMasked') { |
|
426
|
|
|
|
|
|
|
$writer->dataElement($k, $args->{$k}) |
|
427
|
0
|
0
|
|
|
|
|
if exists $args->{$k}; |
|
428
|
|
|
|
|
|
|
} |
|
429
|
|
|
|
|
|
|
} |
|
430
|
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
# order |
|
432
|
0
|
0
|
|
|
|
|
if (exists $args->{order}) { |
|
433
|
0
|
|
|
|
|
|
$writer->startTag('order'); |
|
434
|
0
|
|
|
|
|
|
foreach my $k ('invoiceNumber', 'description', 'purchaseOrderNumber') { |
|
435
|
|
|
|
|
|
|
$writer->dataElement($k, $args->{order}->{$k}) |
|
436
|
0
|
0
|
|
|
|
|
if exists $args->{order}->{$k}; |
|
437
|
|
|
|
|
|
|
} |
|
438
|
0
|
|
|
|
|
|
$writer->endTag('order'); |
|
439
|
|
|
|
|
|
|
} |
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
$writer->dataElement('transId', $args->{transId}) |
|
442
|
|
|
|
|
|
|
if (exists $args->{transId} |
|
443
|
0
|
0
|
0
|
|
|
|
and ($trans_type eq 'profileTransPriorAuthCapture' or $trans_type eq 'profileTransRefund' or $trans_type eq 'profileTransVoid')); |
|
|
|
|
0
|
|
|
|
|
|
444
|
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
$writer->dataElement('taxExempt', $args->{taxExempt}) |
|
446
|
0
|
0
|
|
|
|
|
if exists $args->{taxExempt}; |
|
447
|
|
|
|
|
|
|
$writer->dataElement('recurringBilling', $args->{recurringBilling}) |
|
448
|
0
|
0
|
|
|
|
|
if exists $args->{recurringBilling}; |
|
449
|
0
|
0
|
|
|
|
|
$writer->dataElement('cardCode', $args->{cardCode}) if exists $args->{cardCode}; |
|
450
|
|
|
|
|
|
|
$writer->dataElement('splitTenderId', $args->{splitTenderId}) |
|
451
|
0
|
0
|
|
|
|
|
if exists $args->{splitTenderId}; |
|
452
|
|
|
|
|
|
|
$writer->dataElement('approvalCode', $args->{approvalCode}) |
|
453
|
0
|
0
|
0
|
|
|
|
if exists $args->{approvalCode} and $trans_type eq 'profileTransCaptureOnly'; |
|
454
|
|
|
|
|
|
|
|
|
455
|
0
|
|
|
|
|
|
$writer->endTag($trans_type); |
|
456
|
0
|
|
|
|
|
|
$writer->endTag('transaction'); |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
$writer->dataElement('extraOptions', $args->{extraOptions}) |
|
459
|
0
|
0
|
|
|
|
|
if exists $args->{extraOptions}; |
|
460
|
|
|
|
|
|
|
|
|
461
|
0
|
|
|
|
|
|
$writer->endTag('createCustomerProfileTransactionRequest'); |
|
462
|
0
|
|
|
|
|
|
$writer->end; |
|
463
|
|
|
|
|
|
|
|
|
464
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
465
|
|
|
|
|
|
|
} |
|
466
|
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
sub deleteCustomerProfile { |
|
468
|
0
|
|
|
0
|
1
|
|
my ($self, $customerProfileId) = @_; |
|
469
|
|
|
|
|
|
|
|
|
470
|
0
|
|
|
|
|
|
my $xml; |
|
471
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
472
|
0
|
|
|
|
|
|
$writer->startTag('deleteCustomerProfileRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
473
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
474
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
475
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
476
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
477
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $customerProfileId); |
|
478
|
0
|
|
|
|
|
|
$writer->endTag('deleteCustomerProfileRequest'); |
|
479
|
|
|
|
|
|
|
|
|
480
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
481
|
|
|
|
|
|
|
} |
|
482
|
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
sub deleteCustomerPaymentProfileRequest { |
|
484
|
0
|
|
|
0
|
1
|
|
my ($self, $customerProfileId, $customerPaymentProfileId) = @_; |
|
485
|
|
|
|
|
|
|
|
|
486
|
0
|
|
|
|
|
|
my $xml; |
|
487
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
488
|
0
|
|
|
|
|
|
$writer->startTag('deleteCustomerPaymentProfileRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
489
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
490
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
491
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
492
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
493
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $customerProfileId); |
|
494
|
0
|
|
|
|
|
|
$writer->dataElement('customerPaymentProfileId', $customerPaymentProfileId); |
|
495
|
0
|
|
|
|
|
|
$writer->endTag('deleteCustomerPaymentProfileRequest'); |
|
496
|
0
|
|
|
|
|
|
$writer->end; |
|
497
|
|
|
|
|
|
|
|
|
498
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
499
|
|
|
|
|
|
|
} |
|
500
|
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
sub deleteCustomerShippingAddressRequest { |
|
502
|
0
|
|
|
0
|
1
|
|
my ($self, $customerProfileId, $customerAddressId) = @_; |
|
503
|
|
|
|
|
|
|
|
|
504
|
0
|
|
|
|
|
|
my $xml; |
|
505
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
506
|
0
|
|
|
|
|
|
$writer->startTag('deleteCustomerShippingAddressRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
507
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
508
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
509
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
510
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
511
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $customerProfileId); |
|
512
|
0
|
|
|
|
|
|
$writer->dataElement('customerAddressId', $customerAddressId); |
|
513
|
0
|
|
|
|
|
|
$writer->endTag('deleteCustomerShippingAddressRequest'); |
|
514
|
|
|
|
|
|
|
|
|
515
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
516
|
|
|
|
|
|
|
} |
|
517
|
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
sub getCustomerProfileIds { |
|
519
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
520
|
|
|
|
|
|
|
|
|
521
|
0
|
|
|
|
|
|
my $xml; |
|
522
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
523
|
0
|
|
|
|
|
|
$writer->startTag('getCustomerProfileIdsRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
524
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
525
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
526
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
527
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
528
|
0
|
|
|
|
|
|
$writer->endTag('getCustomerProfileIdsRequest'); |
|
529
|
0
|
|
|
|
|
|
$writer->end; |
|
530
|
|
|
|
|
|
|
|
|
531
|
0
|
|
|
|
|
|
my $d = $self->_send($xml); |
|
532
|
|
|
|
|
|
|
|
|
533
|
0
|
0
|
|
|
|
|
return () unless $d->{ids}; |
|
534
|
|
|
|
|
|
|
|
|
535
|
0
|
|
|
|
|
|
my $id_num = $d->{ids}->{numericString}; |
|
536
|
0
|
0
|
|
|
|
|
my @ids = |
|
|
|
0
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
ref($id_num) eq 'ARRAY' ? @$id_num |
|
538
|
|
|
|
|
|
|
: defined $id_num ? ($id_num) |
|
539
|
|
|
|
|
|
|
: (); |
|
540
|
|
|
|
|
|
|
|
|
541
|
0
|
|
|
|
|
|
return @ids; |
|
542
|
|
|
|
|
|
|
} |
|
543
|
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
sub getCustomerProfile { |
|
545
|
0
|
|
|
0
|
1
|
|
my ($self, $customerProfileId) = @_; |
|
546
|
|
|
|
|
|
|
|
|
547
|
0
|
|
|
|
|
|
my $xml; |
|
548
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
549
|
0
|
|
|
|
|
|
$writer->startTag('getCustomerProfileRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
550
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
551
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
552
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
553
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
554
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $customerProfileId); |
|
555
|
0
|
|
|
|
|
|
$writer->endTag('getCustomerProfileRequest'); |
|
556
|
0
|
|
|
|
|
|
$writer->end; |
|
557
|
|
|
|
|
|
|
|
|
558
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
559
|
|
|
|
|
|
|
} |
|
560
|
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
sub getCustomerPaymentProfileRequest { |
|
562
|
0
|
|
|
0
|
1
|
|
my ($self, $customerProfileId, $customerPaymentProfileId, $args) = @_; |
|
563
|
|
|
|
|
|
|
|
|
564
|
0
|
|
|
|
|
|
my $xml; |
|
565
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
566
|
0
|
|
|
|
|
|
$writer->startTag('getCustomerPaymentProfileRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
567
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
568
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
569
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
570
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
571
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $customerProfileId); |
|
572
|
0
|
|
|
|
|
|
$writer->dataElement('customerPaymentProfileId', $customerPaymentProfileId); |
|
573
|
|
|
|
|
|
|
|
|
574
|
0
|
0
|
|
|
|
|
if ($args) { |
|
575
|
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
# for backwards compatability, if a true non-hash value is passed through |
|
577
|
|
|
|
|
|
|
# we want to act as though we were passed the legacy boolean flag for setting |
|
578
|
|
|
|
|
|
|
# 'unmaskExpirationDate' directly. |
|
579
|
0
|
0
|
|
|
|
|
if (ref($args) eq 'HASH') { |
|
580
|
0
|
|
|
|
|
|
for my $dataElement (grep { exists $args->{$_} } qw(unmaskExpirationDate includeIssuerInfo)) { |
|
|
0
|
|
|
|
|
|
|
|
581
|
0
|
|
|
|
|
|
$writer->dataElement($dataElement, $args->{$dataElement}); |
|
582
|
|
|
|
|
|
|
} |
|
583
|
|
|
|
|
|
|
} else { |
|
584
|
0
|
|
|
|
|
|
$writer->dataElement('unmaskExpirationDate', 'true'); |
|
585
|
|
|
|
|
|
|
} |
|
586
|
|
|
|
|
|
|
} |
|
587
|
0
|
|
|
|
|
|
$writer->endTag('getCustomerPaymentProfileRequest'); |
|
588
|
|
|
|
|
|
|
|
|
589
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
590
|
|
|
|
|
|
|
} |
|
591
|
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
sub getCustomerShippingAddressRequest { |
|
593
|
0
|
|
|
0
|
1
|
|
my ($self, $customerProfileId, $customerAddressId) = @_; |
|
594
|
|
|
|
|
|
|
|
|
595
|
0
|
|
|
|
|
|
my $xml; |
|
596
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
597
|
0
|
|
|
|
|
|
$writer->startTag('getCustomerShippingAddressRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
598
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
599
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
600
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
601
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
602
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $customerProfileId); |
|
603
|
0
|
|
|
|
|
|
$writer->dataElement('customerAddressId', $customerAddressId); |
|
604
|
0
|
|
|
|
|
|
$writer->endTag('getCustomerShippingAddressRequest'); |
|
605
|
0
|
|
|
|
|
|
$writer->end; |
|
606
|
|
|
|
|
|
|
|
|
607
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
608
|
|
|
|
|
|
|
} |
|
609
|
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
sub getHostedProfilePageRequest { |
|
611
|
0
|
|
|
0
|
1
|
|
my ($self, $customerProfileId, $args) = @_; |
|
612
|
|
|
|
|
|
|
|
|
613
|
0
|
|
|
|
|
|
my $xml; |
|
614
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
615
|
0
|
|
|
|
|
|
$writer->startTag('getHostedProfilePageRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
616
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
617
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
618
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
619
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
620
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $customerProfileId); |
|
621
|
|
|
|
|
|
|
|
|
622
|
0
|
0
|
|
|
|
|
if ($args) { |
|
623
|
0
|
|
|
|
|
|
$writer->startTag('hostedProfileSettings'); |
|
624
|
0
|
|
|
|
|
|
foreach my $name (keys %{$args}) { |
|
|
0
|
|
|
|
|
|
|
|
625
|
0
|
|
|
|
|
|
$writer->startTag('setting'); |
|
626
|
0
|
|
|
|
|
|
$writer->dataElement('settingName', $name); |
|
627
|
0
|
|
|
|
|
|
$writer->dataElement('settingValue', $args->{$name}); |
|
628
|
0
|
|
|
|
|
|
$writer->endTag('setting'); |
|
629
|
|
|
|
|
|
|
} |
|
630
|
0
|
|
|
|
|
|
$writer->endTag('hostedProfileSettings'); |
|
631
|
|
|
|
|
|
|
} |
|
632
|
|
|
|
|
|
|
|
|
633
|
0
|
|
|
|
|
|
$writer->endTag('getHostedProfilePageRequest'); |
|
634
|
0
|
|
|
|
|
|
$writer->end; |
|
635
|
|
|
|
|
|
|
|
|
636
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
637
|
|
|
|
|
|
|
} |
|
638
|
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
sub updateCustomerProfile { |
|
640
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
641
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
642
|
|
|
|
|
|
|
|
|
643
|
0
|
|
|
|
|
|
my $xml; |
|
644
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
645
|
0
|
|
|
|
|
|
$writer->startTag('updateCustomerProfileRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
646
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
647
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
648
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
649
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
650
|
0
|
0
|
|
|
|
|
$writer->dataElement('refId', $args->{refId}) if exists $args->{refId}; |
|
651
|
0
|
|
|
|
|
|
$writer->startTag('profile'); |
|
652
|
|
|
|
|
|
|
|
|
653
|
0
|
|
|
|
|
|
foreach my $k ('merchantCustomerId', 'description', 'email') { |
|
654
|
|
|
|
|
|
|
$writer->dataElement($k, $args->{$k}) |
|
655
|
0
|
0
|
|
|
|
|
if exists $args->{$k}; |
|
656
|
|
|
|
|
|
|
} |
|
657
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $args->{customerProfileId}); |
|
658
|
0
|
|
|
|
|
|
$writer->endTag('profile'); |
|
659
|
0
|
|
|
|
|
|
$writer->endTag('updateCustomerProfileRequest'); |
|
660
|
0
|
|
|
|
|
|
$writer->end; |
|
661
|
|
|
|
|
|
|
|
|
662
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
663
|
|
|
|
|
|
|
} |
|
664
|
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
sub updateCustomerPaymentProfile { |
|
666
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
667
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
668
|
|
|
|
|
|
|
|
|
669
|
0
|
|
|
|
|
|
my $xml; |
|
670
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
671
|
0
|
|
|
|
|
|
$writer->startTag('updateCustomerPaymentProfileRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
672
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
673
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
674
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
675
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
676
|
0
|
0
|
|
|
|
|
$writer->dataElement('refId', $args->{refId}) if exists $args->{refId}; |
|
677
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $args->{customerProfileId}); |
|
678
|
|
|
|
|
|
|
|
|
679
|
0
|
|
|
|
|
|
$writer->startTag('paymentProfile'); |
|
680
|
0
|
0
|
|
|
|
|
$writer->dataElement('customerType', $args->{'customerType'}) if exists $args->{'customerType'}; |
|
681
|
|
|
|
|
|
|
|
|
682
|
0
|
|
|
|
|
|
my @flds = ('firstName', 'lastName', 'company', 'address', 'city', 'state', 'zip', 'country', 'phoneNumber', 'faxNumber'); |
|
683
|
0
|
0
|
|
|
|
|
my $addr = exists $args->{billTo} ? $args->{billTo} : $args; |
|
684
|
0
|
0
|
|
|
|
|
if (grep { exists $addr->{$_} } @flds) { |
|
|
0
|
|
|
|
|
|
|
|
685
|
0
|
|
|
|
|
|
$writer->startTag('billTo'); |
|
686
|
0
|
|
|
|
|
|
foreach my $k (@flds) { |
|
687
|
|
|
|
|
|
|
$writer->dataElement($k, $addr->{$k}) |
|
688
|
0
|
0
|
|
|
|
|
if exists $addr->{$k}; |
|
689
|
|
|
|
|
|
|
} |
|
690
|
0
|
|
|
|
|
|
$writer->endTag('billTo'); |
|
691
|
|
|
|
|
|
|
} |
|
692
|
|
|
|
|
|
|
|
|
693
|
0
|
|
|
|
|
|
$writer->startTag('payment'); |
|
694
|
|
|
|
|
|
|
|
|
695
|
0
|
0
|
|
|
|
|
if (exists $args->{creditCard}) { |
|
696
|
0
|
|
|
|
|
|
$writer->startTag('creditCard'); |
|
697
|
0
|
|
|
|
|
|
foreach my $k ('cardNumber', 'expirationDate', 'cardCode') { |
|
698
|
|
|
|
|
|
|
$writer->dataElement($k, $args->{creditCard}->{$k}) |
|
699
|
0
|
0
|
|
|
|
|
if exists $args->{creditCard}->{$k}; |
|
700
|
|
|
|
|
|
|
} |
|
701
|
0
|
|
|
|
|
|
$writer->endTag('creditCard'); |
|
702
|
|
|
|
|
|
|
} |
|
703
|
0
|
0
|
|
|
|
|
if (exists $args->{bankAccount}) { |
|
704
|
0
|
|
|
|
|
|
$writer->startTag('bankAccount'); |
|
705
|
0
|
|
|
|
|
|
foreach my $k ('accountType', 'routingNumber', 'accountNumber', 'nameOnAccount', 'echeckType', 'bankName') { |
|
706
|
0
|
|
|
|
|
|
$writer->dataElement($k, $args->{bankAccount}->{$k}); |
|
707
|
|
|
|
|
|
|
} |
|
708
|
0
|
|
|
|
|
|
$writer->endTag('bankAccount'); |
|
709
|
|
|
|
|
|
|
} |
|
710
|
0
|
0
|
|
|
|
|
if (exists $args->{opaqueData}) { |
|
711
|
0
|
|
|
|
|
|
$writer->startTag('opaqueData'); |
|
712
|
0
|
|
|
|
|
|
foreach my $k (qw/dataDescriptor dataValue/) { |
|
713
|
0
|
|
|
|
|
|
$writer->dataElement($k, $args->{opaqueData}->{$k}); |
|
714
|
|
|
|
|
|
|
} |
|
715
|
0
|
|
|
|
|
|
$writer->endTag('opaqueData'); |
|
716
|
|
|
|
|
|
|
} |
|
717
|
|
|
|
|
|
|
|
|
718
|
0
|
|
|
|
|
|
$writer->endTag('payment'); |
|
719
|
0
|
|
|
|
|
|
$writer->dataElement('customerPaymentProfileId', $args->{customerPaymentProfileId}); |
|
720
|
0
|
|
|
|
|
|
$writer->endTag('paymentProfile'); |
|
721
|
|
|
|
|
|
|
|
|
722
|
0
|
0
|
|
|
|
|
if ($self->{test_mode}) { |
|
|
|
0
|
|
|
|
|
|
|
723
|
0
|
|
|
|
|
|
$writer->dataElement('validationMode', 'testMode'); |
|
724
|
|
|
|
|
|
|
} elsif ($args->{validationMode}) { |
|
725
|
0
|
|
|
|
|
|
$writer->dataElement('validationMode', $args->{validationMode}); |
|
726
|
|
|
|
|
|
|
} else { |
|
727
|
0
|
|
|
|
|
|
$writer->dataElement('validationMode', 'liveMode'); |
|
728
|
|
|
|
|
|
|
} |
|
729
|
0
|
|
|
|
|
|
$writer->endTag('updateCustomerPaymentProfileRequest'); |
|
730
|
0
|
|
|
|
|
|
$writer->end; |
|
731
|
|
|
|
|
|
|
|
|
732
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
733
|
|
|
|
|
|
|
} |
|
734
|
|
|
|
|
|
|
|
|
735
|
|
|
|
|
|
|
sub updateCustomerShippingAddress { |
|
736
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
737
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
738
|
|
|
|
|
|
|
|
|
739
|
0
|
|
|
|
|
|
my $xml; |
|
740
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
741
|
0
|
|
|
|
|
|
$writer->startTag('updateCustomerShippingAddressRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
742
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
743
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
744
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
745
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
746
|
0
|
0
|
|
|
|
|
$writer->dataElement('refId', $args->{refId}) if exists $args->{refId}; |
|
747
|
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $args->{customerProfileId}) |
|
748
|
0
|
0
|
|
|
|
|
if exists $args->{customerProfileId}; |
|
749
|
0
|
|
|
|
|
|
$writer->startTag('address'); |
|
750
|
|
|
|
|
|
|
|
|
751
|
0
|
|
|
|
|
|
my @flds = ('firstName', 'lastName', 'company', 'address', 'city', 'state', 'zip', 'country', 'phoneNumber', 'faxNumber'); |
|
752
|
0
|
0
|
|
|
|
|
my $addr = exists $args->{shipToList} ? $args->{shipToList} : $args; |
|
753
|
0
|
|
|
|
|
|
foreach my $k (@flds) { |
|
754
|
|
|
|
|
|
|
$writer->dataElement($k, $addr->{$k}) |
|
755
|
0
|
0
|
|
|
|
|
if exists $addr->{$k}; |
|
756
|
|
|
|
|
|
|
} |
|
757
|
|
|
|
|
|
|
|
|
758
|
0
|
|
|
|
|
|
$writer->dataElement('customerAddressId', $args->{customerAddressId}); |
|
759
|
0
|
|
|
|
|
|
$writer->endTag('address'); |
|
760
|
|
|
|
|
|
|
|
|
761
|
0
|
|
|
|
|
|
$writer->endTag('updateCustomerShippingAddressRequest'); |
|
762
|
0
|
|
|
|
|
|
$writer->end; |
|
763
|
|
|
|
|
|
|
|
|
764
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
765
|
|
|
|
|
|
|
} |
|
766
|
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
sub updateSplitTenderGroupRequest { |
|
768
|
0
|
|
|
0
|
1
|
|
my ($self, $splitTenderId, $splitTenderStatus) = @_; |
|
769
|
|
|
|
|
|
|
|
|
770
|
0
|
|
|
|
|
|
my $xml; |
|
771
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
772
|
0
|
|
|
|
|
|
$writer->startTag('updateSplitTenderGroupRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
773
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
774
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
775
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
776
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
777
|
0
|
|
|
|
|
|
$writer->dataElement('splitTenderId', $splitTenderId); |
|
778
|
0
|
|
|
|
|
|
$writer->dataElement('splitTenderStatus', $splitTenderStatus); |
|
779
|
0
|
|
|
|
|
|
$writer->endTag('updateSplitTenderGroupRequest'); |
|
780
|
0
|
|
|
|
|
|
$writer->end; |
|
781
|
|
|
|
|
|
|
|
|
782
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
783
|
|
|
|
|
|
|
} |
|
784
|
|
|
|
|
|
|
|
|
785
|
|
|
|
|
|
|
sub validateCustomerPaymentProfile { |
|
786
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
787
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
788
|
|
|
|
|
|
|
|
|
789
|
0
|
|
|
|
|
|
my $xml; |
|
790
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
791
|
0
|
|
|
|
|
|
$writer->startTag('validateCustomerPaymentProfileRequest', 'xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
792
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
793
|
0
|
|
|
|
|
|
$writer->dataElement('name', $self->{login}); |
|
794
|
0
|
|
|
|
|
|
$writer->dataElement('transactionKey', $self->{transactionKey}); |
|
795
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
796
|
0
|
|
|
|
|
|
$writer->dataElement('customerProfileId', $args->{customerProfileId}); |
|
797
|
0
|
|
|
|
|
|
$writer->dataElement('customerPaymentProfileId', $args->{customerPaymentProfileId}); |
|
798
|
|
|
|
|
|
|
$writer->dataElement('customerShippingAddressId', $args->{customerShippingAddressId}) |
|
799
|
0
|
0
|
|
|
|
|
if $args->{customerShippingAddressId}; |
|
800
|
0
|
0
|
|
|
|
|
$writer->dataElement('cardCode', $args->{cardCode}) if $args->{cardCode}; |
|
801
|
|
|
|
|
|
|
|
|
802
|
0
|
0
|
|
|
|
|
if ($self->{test_mode}) { |
|
803
|
0
|
|
|
|
|
|
$writer->dataElement('validationMode', 'testMode'); |
|
804
|
|
|
|
|
|
|
} else { |
|
805
|
0
|
|
|
|
|
|
$writer->dataElement('validationMode', 'liveMode'); |
|
806
|
|
|
|
|
|
|
} |
|
807
|
0
|
|
|
|
|
|
$writer->endTag('validateCustomerPaymentProfileRequest'); |
|
808
|
0
|
|
|
|
|
|
$writer->end; |
|
809
|
|
|
|
|
|
|
|
|
810
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
811
|
|
|
|
|
|
|
} |
|
812
|
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
sub getMerchantDetailsRequest { |
|
814
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
815
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
816
|
|
|
|
|
|
|
|
|
817
|
0
|
|
|
|
|
|
my $xml; |
|
818
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
819
|
0
|
|
|
|
|
|
$writer->startTag('getMerchantDetailsRequest', xmlns => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
820
|
0
|
|
|
|
|
|
$self->_addAuthentication($writer); |
|
821
|
0
|
|
|
|
|
|
$writer->endTag('getMerchantDetailsRequest'); |
|
822
|
0
|
|
|
|
|
|
$writer->end; |
|
823
|
|
|
|
|
|
|
|
|
824
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
825
|
|
|
|
|
|
|
} |
|
826
|
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
sub getTransactionDetailsRequest { |
|
828
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
829
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
830
|
|
|
|
|
|
|
|
|
831
|
0
|
|
|
|
|
|
my $xml; |
|
832
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
833
|
0
|
|
|
|
|
|
$writer->startTag('getTransactionDetailsRequest', xmlns => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
834
|
0
|
|
|
|
|
|
$self->_addAuthentication($writer); |
|
835
|
|
|
|
|
|
|
|
|
836
|
0
|
0
|
|
|
|
|
$writer->dataElement(refId => $args->{refId}) if defined $args->{refId}; |
|
837
|
0
|
|
|
|
|
|
$writer->dataElement(transId => $args->{transId}); |
|
838
|
|
|
|
|
|
|
|
|
839
|
0
|
|
|
|
|
|
$writer->endTag('getTransactionDetailsRequest'); |
|
840
|
0
|
|
|
|
|
|
$writer->end; |
|
841
|
|
|
|
|
|
|
|
|
842
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
843
|
|
|
|
|
|
|
} |
|
844
|
|
|
|
|
|
|
|
|
845
|
|
|
|
|
|
|
sub getTransactionListForCustomerRequest { |
|
846
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
847
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
848
|
|
|
|
|
|
|
|
|
849
|
0
|
|
|
|
|
|
my $xml; |
|
850
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
851
|
0
|
|
|
|
|
|
$writer->startTag('getTransactionListForCustomerRequest', xmlns => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
852
|
0
|
|
|
|
|
|
$self->_addAuthentication($writer); |
|
853
|
|
|
|
|
|
|
|
|
854
|
0
|
0
|
|
|
|
|
$writer->dataElement(refId => $args->{refId}) if defined $args->{refId}; |
|
855
|
0
|
|
|
|
|
|
$writer->dataElement(customerProfileId => $args->{customerProfileId}); |
|
856
|
|
|
|
|
|
|
$writer->dataElement(customerPaymentProfileId => $args->{customerPaymentProfileId}) |
|
857
|
0
|
0
|
|
|
|
|
if $args->{customerPaymentProfileId}; |
|
858
|
|
|
|
|
|
|
|
|
859
|
0
|
|
|
|
|
|
$self->_addHash($writer, 'sorting', $args, qw); |
|
860
|
0
|
|
|
|
|
|
$self->_addHash($writer, 'paging', $args, qw); |
|
861
|
0
|
|
|
|
|
|
$writer->endTag('getTransactionListForCustomerRequest'); |
|
862
|
0
|
|
|
|
|
|
$writer->end; |
|
863
|
|
|
|
|
|
|
|
|
864
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
865
|
|
|
|
|
|
|
} |
|
866
|
|
|
|
|
|
|
|
|
867
|
|
|
|
|
|
|
sub getUnsettledTransactionListRequest { |
|
868
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
869
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
870
|
|
|
|
|
|
|
|
|
871
|
0
|
|
|
|
|
|
my $xml; |
|
872
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
873
|
0
|
|
|
|
|
|
$writer->startTag('getUnsettledTransactionListRequest', xmlns => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
874
|
0
|
|
|
|
|
|
$self->_addAuthentication($writer); |
|
875
|
|
|
|
|
|
|
|
|
876
|
0
|
0
|
|
|
|
|
$writer->dataElement(refId => $args->{refId}) if defined $args->{refId}; |
|
877
|
|
|
|
|
|
|
|
|
878
|
0
|
|
|
|
|
|
$self->_addHash($writer, 'sorting', $args, qw); |
|
879
|
0
|
|
|
|
|
|
$self->_addHash($writer, 'paging', $args, qw); |
|
880
|
0
|
|
|
|
|
|
$writer->endTag('getUnsettledTransactionListRequest'); |
|
881
|
0
|
|
|
|
|
|
$writer->end; |
|
882
|
|
|
|
|
|
|
|
|
883
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
884
|
|
|
|
|
|
|
} |
|
885
|
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
sub getSettledBatchListRequest { |
|
887
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
888
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
889
|
|
|
|
|
|
|
|
|
890
|
0
|
|
|
|
|
|
my $xml; |
|
891
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
892
|
0
|
|
|
|
|
|
$writer->startTag('getSettledBatchListRequest', xmlns => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
893
|
0
|
|
|
|
|
|
$self->_addAuthentication($writer); |
|
894
|
|
|
|
|
|
|
|
|
895
|
0
|
0
|
|
|
|
|
$writer->dataElement(refId => $args->{refId}) if defined $args->{refId}; |
|
896
|
|
|
|
|
|
|
$writer->dataElement(includeStatistics => $args->{includeStatistics}) |
|
897
|
0
|
0
|
|
|
|
|
if defined $args->{includeStatistics}; |
|
898
|
|
|
|
|
|
|
$writer->dataElement(firstSettlementDate => $args->{firstSettlementDate}) |
|
899
|
0
|
0
|
|
|
|
|
if defined $args->{firstSettlementDate}; |
|
900
|
|
|
|
|
|
|
$writer->dataElement(lastSettlementDate => $args->{lastSettlementDate}) |
|
901
|
0
|
0
|
|
|
|
|
if defined $args->{lastSettlementDate}; |
|
902
|
|
|
|
|
|
|
|
|
903
|
0
|
|
|
|
|
|
$writer->endTag('getSettledBatchListRequest'); |
|
904
|
0
|
|
|
|
|
|
$writer->end; |
|
905
|
|
|
|
|
|
|
|
|
906
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
907
|
|
|
|
|
|
|
} |
|
908
|
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
sub getTransactionListRequest { |
|
910
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
911
|
0
|
0
|
|
|
|
|
my $args = scalar @_ % 2 ? shift : {@_}; |
|
912
|
|
|
|
|
|
|
|
|
913
|
0
|
|
|
|
|
|
my $xml; |
|
914
|
0
|
|
|
|
|
|
my $writer = XML::Writer->new(OUTPUT => \$xml); |
|
915
|
0
|
|
|
|
|
|
$writer->startTag('getTransactionListRequest', xmlns => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'); |
|
916
|
0
|
|
|
|
|
|
$self->_addAuthentication($writer); |
|
917
|
|
|
|
|
|
|
|
|
918
|
0
|
0
|
|
|
|
|
$writer->dataElement(refId => $args->{refId}) if defined $args->{refId}; |
|
919
|
0
|
|
|
|
|
|
$writer->dataElement(batchId => $args->{batchId}); |
|
920
|
|
|
|
|
|
|
|
|
921
|
0
|
|
|
|
|
|
$self->_addHash($writer, 'sorting', $args, qw); |
|
922
|
0
|
|
|
|
|
|
$self->_addHash($writer, 'paging', $args, qw); |
|
923
|
0
|
|
|
|
|
|
$writer->endTag('getTransactionListRequest'); |
|
924
|
0
|
|
|
|
|
|
$writer->end; |
|
925
|
|
|
|
|
|
|
|
|
926
|
0
|
|
|
|
|
|
return $self->_send($xml); |
|
927
|
|
|
|
|
|
|
} |
|
928
|
|
|
|
|
|
|
|
|
929
|
|
|
|
|
|
|
sub _addAuthentication { |
|
930
|
0
|
|
|
0
|
|
|
my ($self, $writer) = @_; |
|
931
|
0
|
|
|
|
|
|
$writer->startTag('merchantAuthentication'); |
|
932
|
0
|
|
|
|
|
|
$writer->dataElement(name => $self->{login}); |
|
933
|
0
|
|
|
|
|
|
$writer->dataElement(transactionKey => $self->{transactionKey}); |
|
934
|
0
|
|
|
|
|
|
$writer->endTag('merchantAuthentication'); |
|
935
|
|
|
|
|
|
|
} |
|
936
|
|
|
|
|
|
|
|
|
937
|
|
|
|
|
|
|
sub _addHash { |
|
938
|
0
|
|
|
0
|
|
|
my ($self, $writer, $tagname, $argsref, @selectedkeys) = @_; |
|
939
|
0
|
0
|
|
|
|
|
return unless my $hash = $argsref->{$tagname}; |
|
940
|
0
|
0
|
|
|
|
|
@selectedkeys = keys %$hash unless @selectedkeys; |
|
941
|
|
|
|
|
|
|
|
|
942
|
0
|
|
|
|
|
|
$writer->startTag($tagname); |
|
943
|
0
|
|
|
|
|
|
foreach my $k (@selectedkeys) { |
|
944
|
0
|
0
|
|
|
|
|
$writer->dataElement($k => $hash->{$k}) if defined $hash->{$k}; |
|
945
|
|
|
|
|
|
|
} |
|
946
|
0
|
|
|
|
|
|
$writer->endTag($tagname); |
|
947
|
|
|
|
|
|
|
} |
|
948
|
|
|
|
|
|
|
|
|
949
|
|
|
|
|
|
|
sub _send { |
|
950
|
0
|
|
|
0
|
|
|
my ($self, $xml) = @_; |
|
951
|
|
|
|
|
|
|
|
|
952
|
0
|
|
|
|
|
|
$xml = '' . "\n" . $xml; |
|
953
|
0
|
0
|
|
|
|
|
print "\n\n" if $self->{debug}; |
|
954
|
0
|
|
|
|
|
|
my $resp = $self->{ua}->post($self->{url}, Content => $xml, 'Content-Type' => 'text/xml'); |
|
955
|
0
|
0
|
|
|
|
|
print "\n\n" if $self->{debug}; |
|
956
|
|
|
|
|
|
|
|
|
957
|
0
|
|
|
|
|
|
my $d = XMLin($resp->content, SuppressEmpty => ''); |
|
958
|
0
|
|
|
|
|
|
return $d; |
|
959
|
|
|
|
|
|
|
} |
|
960
|
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
1; |
|
962
|
|
|
|
|
|
|
|
|
963
|
|
|
|
|
|
|
__END__ |