authorizenet 1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/app/helpers/authorize_net_helper.rb +24 -0
- data/lib/authorize_net.rb +92 -0
- data/lib/authorize_net/addresses/address.rb +29 -0
- data/lib/authorize_net/addresses/shipping_address.rb +26 -0
- data/lib/authorize_net/aim/response.rb +131 -0
- data/lib/authorize_net/aim/transaction.rb +184 -0
- data/lib/authorize_net/arb/response.rb +34 -0
- data/lib/authorize_net/arb/subscription.rb +72 -0
- data/lib/authorize_net/arb/transaction.rb +146 -0
- data/lib/authorize_net/authorize_net.rb +154 -0
- data/lib/authorize_net/cim/customer_profile.rb +19 -0
- data/lib/authorize_net/cim/payment_profile.rb +37 -0
- data/lib/authorize_net/cim/response.rb +110 -0
- data/lib/authorize_net/cim/transaction.rb +678 -0
- data/lib/authorize_net/customer.rb +27 -0
- data/lib/authorize_net/email_receipt.rb +24 -0
- data/lib/authorize_net/fields.rb +736 -0
- data/lib/authorize_net/key_value_response.rb +117 -0
- data/lib/authorize_net/key_value_transaction.rb +291 -0
- data/lib/authorize_net/line_item.rb +25 -0
- data/lib/authorize_net/order.rb +42 -0
- data/lib/authorize_net/payment_methods/credit_card.rb +74 -0
- data/lib/authorize_net/payment_methods/echeck.rb +72 -0
- data/lib/authorize_net/reporting/batch.rb +19 -0
- data/lib/authorize_net/reporting/batch_statistics.rb +19 -0
- data/lib/authorize_net/reporting/fds_filter.rb +11 -0
- data/lib/authorize_net/reporting/response.rb +127 -0
- data/lib/authorize_net/reporting/transaction.rb +116 -0
- data/lib/authorize_net/reporting/transaction_details.rb +25 -0
- data/lib/authorize_net/response.rb +27 -0
- data/lib/authorize_net/sim/hosted_payment_form.rb +38 -0
- data/lib/authorize_net/sim/hosted_receipt_page.rb +37 -0
- data/lib/authorize_net/sim/response.rb +142 -0
- data/lib/authorize_net/sim/transaction.rb +138 -0
- data/lib/authorize_net/transaction.rb +66 -0
- data/lib/authorize_net/xml +65 -0
- data/lib/authorize_net/xml_response.rb +172 -0
- data/lib/authorize_net/xml_transaction.rb +275 -0
- data/lib/authorizenet.rb +4 -0
- data/lib/generators/authorize_net/direct_post_generator.rb +51 -0
- data/lib/generators/authorize_net/sim_generator.rb +47 -0
- data/lib/yankl.rb +4 -0
- metadata +106 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
module AuthorizeNet
|
2
|
+
|
3
|
+
# Models a customer.
|
4
|
+
class Customer
|
5
|
+
attr_accessor
|
6
|
+
include AuthorizeNet::Model
|
7
|
+
|
8
|
+
attr_accessor :phone, :fax, :email, :id, :ip, :address, :description
|
9
|
+
|
10
|
+
def to_hash
|
11
|
+
hash = {
|
12
|
+
:phone => @phone,
|
13
|
+
:fax => @fax,
|
14
|
+
:email => @email,
|
15
|
+
:cust_id => @id,
|
16
|
+
:customer_ip => @ip,
|
17
|
+
:description => @description,
|
18
|
+
:customer_profile_id => @customer_profile_id
|
19
|
+
}
|
20
|
+
hash.delete_if {|k, v| v.nil?}
|
21
|
+
hash.merge!(@address.to_hash) unless @address.nil?
|
22
|
+
hash
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module AuthorizeNet
|
2
|
+
|
3
|
+
# Models an email receipt.
|
4
|
+
class EmailReceipt
|
5
|
+
|
6
|
+
include AuthorizeNet::Model
|
7
|
+
|
8
|
+
attr_accessor :header, :footer, :merchant_email, :email_customer
|
9
|
+
|
10
|
+
def to_hash
|
11
|
+
hash = {
|
12
|
+
:header => @header,
|
13
|
+
:footer => @footer,
|
14
|
+
:merchant_email => @merchant_email,
|
15
|
+
:email_customer => @email_customer
|
16
|
+
}
|
17
|
+
hash.delete_if {|k, v| v.nil?}
|
18
|
+
hash.merge(@address.to_hash) unless @address.nil?
|
19
|
+
hash
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,736 @@
|
|
1
|
+
module AuthorizeNet
|
2
|
+
|
3
|
+
EntityDescription = Struct.new(:node_structure, :entity_class, :arg_mapping)
|
4
|
+
|
5
|
+
module AIM
|
6
|
+
# Contains the various lists of fields needed by the AIM API.
|
7
|
+
module Fields
|
8
|
+
|
9
|
+
# Enumeration of the fields found in the AIM response. The index
|
10
|
+
# of the field name corresponds to its position (+ 1) in the AIM response.
|
11
|
+
FIELDS = [
|
12
|
+
:response_code,
|
13
|
+
:response_subcode,
|
14
|
+
:response_reason_code,
|
15
|
+
:response_reason_text,
|
16
|
+
:authorization_code,
|
17
|
+
:avs_response,
|
18
|
+
:transaction_id,
|
19
|
+
:invoice_number,
|
20
|
+
:description,
|
21
|
+
:amount,
|
22
|
+
:method,
|
23
|
+
:transaction_type,
|
24
|
+
:customer_id,
|
25
|
+
:first_name,
|
26
|
+
:last_name,
|
27
|
+
:company,
|
28
|
+
:address,
|
29
|
+
:city,
|
30
|
+
:state,
|
31
|
+
:zip_code,
|
32
|
+
:country,
|
33
|
+
:phone,
|
34
|
+
:fax,
|
35
|
+
:email_address,
|
36
|
+
:ship_to_first_name,
|
37
|
+
:ship_to_last_name,
|
38
|
+
:ship_to_company,
|
39
|
+
:ship_to_address,
|
40
|
+
:ship_to_city,
|
41
|
+
:ship_to_state,
|
42
|
+
:ship_to_zip_code,
|
43
|
+
:ship_to_country,
|
44
|
+
:tax,
|
45
|
+
:duty,
|
46
|
+
:freight,
|
47
|
+
:tax_exempt,
|
48
|
+
:purchase_order_number,
|
49
|
+
:md5_hash,
|
50
|
+
:card_code_response,
|
51
|
+
:cardholder_authentication_verification_response,
|
52
|
+
nil,
|
53
|
+
nil,
|
54
|
+
nil,
|
55
|
+
nil,
|
56
|
+
nil,
|
57
|
+
nil,
|
58
|
+
nil,
|
59
|
+
nil,
|
60
|
+
nil,
|
61
|
+
nil,
|
62
|
+
:account_number,
|
63
|
+
:card_type,
|
64
|
+
:split_tender_id,
|
65
|
+
:requested,
|
66
|
+
:balance_on_card,
|
67
|
+
nil,
|
68
|
+
nil,
|
69
|
+
nil,
|
70
|
+
nil,
|
71
|
+
nil,
|
72
|
+
nil,
|
73
|
+
nil,
|
74
|
+
nil,
|
75
|
+
nil,
|
76
|
+
nil,
|
77
|
+
nil,
|
78
|
+
nil,
|
79
|
+
nil # Merchant defined fields come after this field (68)
|
80
|
+
]
|
81
|
+
|
82
|
+
# Enumeration of the fields found in the card present AIM response. The index
|
83
|
+
# of the field name corresponds to its position (+ 1) in the card present AIM response.
|
84
|
+
CP_FIELDS = [
|
85
|
+
:cp_version,
|
86
|
+
:response_code,
|
87
|
+
:response_reason_code,
|
88
|
+
:response_reason_text,
|
89
|
+
:authorization_code,
|
90
|
+
:avs_response,
|
91
|
+
:card_code_response,
|
92
|
+
:transaction_id,
|
93
|
+
:md5_hash,
|
94
|
+
:reference_id,
|
95
|
+
nil,
|
96
|
+
nil,
|
97
|
+
nil,
|
98
|
+
nil,
|
99
|
+
nil,
|
100
|
+
nil,
|
101
|
+
nil,
|
102
|
+
nil,
|
103
|
+
nil,
|
104
|
+
nil,
|
105
|
+
:account_number,
|
106
|
+
:card_type,
|
107
|
+
:split_tender_id,
|
108
|
+
:requested,
|
109
|
+
:approved_amount,
|
110
|
+
:balance_on_card
|
111
|
+
]
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
module SIM
|
116
|
+
# Contains the various lists of fields needed by the SIM API.
|
117
|
+
module Fields
|
118
|
+
# List of the fields found in a SIM response. Any field not in this list
|
119
|
+
# is treated as a Merchant Defined Field.
|
120
|
+
FIELDS = [
|
121
|
+
:x_response_code,
|
122
|
+
:x_response_subcode,
|
123
|
+
:x_response_reason_code,
|
124
|
+
:x_response_reason_text,
|
125
|
+
:x_auth_code,
|
126
|
+
:x_avs_code,
|
127
|
+
:x_trans_id,
|
128
|
+
:x_invoice_num,
|
129
|
+
:x_description,
|
130
|
+
:x_amount,
|
131
|
+
:x_method,
|
132
|
+
:x_type,
|
133
|
+
:x_cust_id,
|
134
|
+
:x_first_name,
|
135
|
+
:x_last_name,
|
136
|
+
:x_company,
|
137
|
+
:x_address,
|
138
|
+
:x_city,
|
139
|
+
:x_state,
|
140
|
+
:x_zip,
|
141
|
+
:x_country,
|
142
|
+
:x_phone,
|
143
|
+
:x_fax,
|
144
|
+
:x_email,
|
145
|
+
:x_ship_to_first_name,
|
146
|
+
:x_ship_to_last_name,
|
147
|
+
:x_ship_to_company,
|
148
|
+
:x_ship_to_address,
|
149
|
+
:x_ship_to_city,
|
150
|
+
:x_ship_to_state,
|
151
|
+
:x_ship_to_zip,
|
152
|
+
:x_ship_to_country,
|
153
|
+
:x_tax,
|
154
|
+
:x_duty,
|
155
|
+
:x_freight,
|
156
|
+
:x_tax_exempt,
|
157
|
+
:x_po_num,
|
158
|
+
:x_MD5_Hash,
|
159
|
+
:x_cvv2_resp_code,
|
160
|
+
:x_cavv_response
|
161
|
+
]
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
module ARB
|
166
|
+
# Contains the various lists of fields needed by the ARB API.
|
167
|
+
module Fields
|
168
|
+
|
169
|
+
# Describes the order and nesting of fields in the ARB Subscription XML.
|
170
|
+
SUBSCRIPTION_FIELDS = {:subscription => [
|
171
|
+
{:name => :subscription_name},
|
172
|
+
{:paymentSchedule => [
|
173
|
+
{:interval => [
|
174
|
+
{:length => :subscription_length},
|
175
|
+
{:unit => :subscription_unit}
|
176
|
+
]},
|
177
|
+
{:startDate => :subscription_start_date},
|
178
|
+
{:totalOccurrences => :subscription_total_occurrences},
|
179
|
+
{:trialOccurrences => :subscription_trial_occurrences}
|
180
|
+
]},
|
181
|
+
{:amount => :subscription_amount},
|
182
|
+
{:trialAmount => :subscription_trial_amount},
|
183
|
+
{:payment => [
|
184
|
+
{:creditCard => [
|
185
|
+
{:cardNumber => :card_num},
|
186
|
+
{:expirationDate => :exp_date},
|
187
|
+
{:cardCode => :card_code}
|
188
|
+
]},
|
189
|
+
{:bankAccount => [
|
190
|
+
{:accountType => :bank_acct_type},
|
191
|
+
{:routingNumber => :bank_aba_code},
|
192
|
+
{:accountNumber => :bank_acct_num},
|
193
|
+
{:nameOnAccount => :bank_acct_name},
|
194
|
+
{:echeckType => :echeck_type},
|
195
|
+
{:bankName => :bank_name}
|
196
|
+
]}
|
197
|
+
]},
|
198
|
+
{:order => [
|
199
|
+
{:invoiceNumber => :invoice_num},
|
200
|
+
{:description => :description}
|
201
|
+
]},
|
202
|
+
{:customer => [
|
203
|
+
{:id_ => :cust_id},
|
204
|
+
{:email => :email},
|
205
|
+
{:phoneNumber => :phone},
|
206
|
+
{:faxNumber => :fax}
|
207
|
+
]},
|
208
|
+
{:billTo => [
|
209
|
+
{:firstName => :first_name},
|
210
|
+
{:lastName => :last_name},
|
211
|
+
{:company => :company},
|
212
|
+
{:address => :address},
|
213
|
+
{:city => :city},
|
214
|
+
{:state => :state},
|
215
|
+
{:zip => :zip},
|
216
|
+
{:country => :country}
|
217
|
+
]},
|
218
|
+
{:shipTo => [
|
219
|
+
{:firstName => :ship_to_first_name},
|
220
|
+
{:lastName => :ship_to_last_name},
|
221
|
+
{:company => :ship_to_company},
|
222
|
+
{:address => :ship_to_address},
|
223
|
+
{:city => :ship_to_city},
|
224
|
+
{:state => :ship_to_state},
|
225
|
+
{:zip => :ship_to_zip},
|
226
|
+
{:country => :ship_to_country}
|
227
|
+
]}
|
228
|
+
]}
|
229
|
+
|
230
|
+
# Describes the order and nesting of fields in the ARB ARBCreateSubscriptionRequest XML.
|
231
|
+
CREATE_FIELDS = [
|
232
|
+
{:refId => :reference_id},
|
233
|
+
SUBSCRIPTION_FIELDS
|
234
|
+
]
|
235
|
+
|
236
|
+
# Describes the order and nesting of fields in the ARB ARBUpdateSubscriptionRequest XML.
|
237
|
+
UPDATE_FIELDS = [
|
238
|
+
{:refId => :reference_id},
|
239
|
+
{:subscriptionId => :subscription_id},
|
240
|
+
SUBSCRIPTION_FIELDS
|
241
|
+
]
|
242
|
+
|
243
|
+
# Describes the order and nesting of fields in the ARB ARBGetSubscriptionStatusRequest XML.
|
244
|
+
GET_STATUS_FIELDS = [
|
245
|
+
{:refId => :reference_id},
|
246
|
+
{:subscriptionId => :subscription_id}
|
247
|
+
]
|
248
|
+
|
249
|
+
# Describes the order and nesting of fields in the ARB ARBCancelSubscriptionRequest XML.
|
250
|
+
CANCEL_FIELDS = [
|
251
|
+
{:refId => :reference_id},
|
252
|
+
{:subscriptionId => :subscription_id}
|
253
|
+
]
|
254
|
+
|
255
|
+
FIELDS = {
|
256
|
+
AuthorizeNet::XmlTransaction::Type::ARB_CREATE => CREATE_FIELDS,
|
257
|
+
AuthorizeNet::XmlTransaction::Type::ARB_UPDATE => UPDATE_FIELDS,
|
258
|
+
AuthorizeNet::XmlTransaction::Type::ARB_GET_STATUS => GET_STATUS_FIELDS,
|
259
|
+
AuthorizeNet::XmlTransaction::Type::ARB_CANCEL => CANCEL_FIELDS
|
260
|
+
}
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
module CIM
|
265
|
+
module Fields
|
266
|
+
|
267
|
+
REFID_FIELDS = {:refId => :reference_id}
|
268
|
+
|
269
|
+
VALIDATION_MODE_FIELDS = {:validationMode => :validation_mode}
|
270
|
+
|
271
|
+
CUSTOMER_PROFILE_ID_FIELDS = {:customerProfileId => :customer_profile_id}
|
272
|
+
|
273
|
+
CUSTOMER_PAYMENT_PROFILE_ID_FIELDS = {:customerPaymentProfileId => :customer_payment_profile_id}
|
274
|
+
|
275
|
+
BILL_TO_FIELDS = {:billTo => [
|
276
|
+
{:firstName => :first_name},
|
277
|
+
{:lastName => :last_name},
|
278
|
+
{:company => :company},
|
279
|
+
{:address => :address},
|
280
|
+
{:city => :city},
|
281
|
+
{:state => :state},
|
282
|
+
{:zip => :zip},
|
283
|
+
{:country => :country},
|
284
|
+
{:phoneNumber => :phone},
|
285
|
+
{:faxNumber => :fax}
|
286
|
+
]}
|
287
|
+
|
288
|
+
SHIP_TO_FIELDS = {:shipTo => [
|
289
|
+
{:firstName => :ship_to_first_name},
|
290
|
+
{:lastName => :ship_to_last_name},
|
291
|
+
{:company => :ship_to_company},
|
292
|
+
{:address => :ship_to_address},
|
293
|
+
{:city => :ship_to_city},
|
294
|
+
{:state => :ship_to_state},
|
295
|
+
{:zip => :ship_to_zip},
|
296
|
+
{:country => :ship_to_country},
|
297
|
+
{:phoneNumber => :ship_to_phone},
|
298
|
+
{:faxNumber => :ship_to_fax}
|
299
|
+
], :_multivalue => :addresses}
|
300
|
+
|
301
|
+
ADDRESS_FIELDS = {:address => [
|
302
|
+
{:firstName => :first_name},
|
303
|
+
{:lastName => :last_name},
|
304
|
+
{:company => :company},
|
305
|
+
{:address => :address},
|
306
|
+
{:city => :city},
|
307
|
+
{:state => :state},
|
308
|
+
{:zip => :zip},
|
309
|
+
{:country => :country},
|
310
|
+
{:phoneNumber => :phone},
|
311
|
+
{:faxNumber => :fax}
|
312
|
+
]
|
313
|
+
}
|
314
|
+
|
315
|
+
PAYMENT_PROFILE_FIELDS = [
|
316
|
+
{:customerType => :cust_type},
|
317
|
+
BILL_TO_FIELDS,
|
318
|
+
{:payment => [
|
319
|
+
{:creditCard => [
|
320
|
+
{:cardNumber => :card_num},
|
321
|
+
{:expirationDate => :exp_date},
|
322
|
+
{:cardCode => :card_code}
|
323
|
+
]},
|
324
|
+
{:bankAccount => [
|
325
|
+
{:accountType => :bank_acct_type},
|
326
|
+
{:routingNumber => :bank_aba_code},
|
327
|
+
{:accountNumber => :bank_acct_num},
|
328
|
+
{:nameOnAccount => :bank_acct_name},
|
329
|
+
{:echeckType => :echeck_type},
|
330
|
+
{:bankName => :bank_name}
|
331
|
+
]}
|
332
|
+
]}
|
333
|
+
]
|
334
|
+
|
335
|
+
PROFILE_FIELDS = {:profile => [
|
336
|
+
{:merchantCustomerId => :cust_id},
|
337
|
+
{:description => :description},
|
338
|
+
{:email => :email},
|
339
|
+
{:paymentProfiles => PAYMENT_PROFILE_FIELDS, :_multivalue => :payment_profiles},
|
340
|
+
SHIP_TO_FIELDS
|
341
|
+
]}
|
342
|
+
|
343
|
+
TRANSACTION_FIELDS = [
|
344
|
+
{:amount => :amount},
|
345
|
+
{:tax => [
|
346
|
+
{:amount => :tax},
|
347
|
+
{:name => :tax_name},
|
348
|
+
{:description => :tax_description}
|
349
|
+
]},
|
350
|
+
{:shipping => [
|
351
|
+
{:amount => :freight},
|
352
|
+
{:name => :freight_name},
|
353
|
+
{:description => :freight_description}
|
354
|
+
]},
|
355
|
+
{:duty => [
|
356
|
+
{:amount => :duty},
|
357
|
+
{:name => :duty_name},
|
358
|
+
{:description => :duty_description}
|
359
|
+
]},
|
360
|
+
{:lineItems => [
|
361
|
+
{:itemId => :line_item_id},
|
362
|
+
{:name => :line_item_name},
|
363
|
+
{:description => :line_item_description},
|
364
|
+
{:quantity => :line_item_quantity},
|
365
|
+
{:unitPrice => :line_item_unit_price},
|
366
|
+
{:taxable => :line_item_taxable}
|
367
|
+
], :_multivalue => :line_items},
|
368
|
+
CUSTOMER_PROFILE_ID_FIELDS,
|
369
|
+
CUSTOMER_PAYMENT_PROFILE_ID_FIELDS,
|
370
|
+
{:customerShippingAddressId => :customer_address_id},
|
371
|
+
{:creditCardNumberMasked => :card_num_masked},
|
372
|
+
{:bankRoutingNumberMasked => :bank_aba_code_masked},
|
373
|
+
{:bankAccountNumberMasked => :bank_acct_num_masked},
|
374
|
+
{:order => [
|
375
|
+
{:invoiceNumber => :invoice_number},
|
376
|
+
{:description => :description},
|
377
|
+
{:purchaseOrderNumber => :po_num}
|
378
|
+
]},
|
379
|
+
{:taxExempt => :tax_exempt},
|
380
|
+
{:recurringBilling => :recurring_billing},
|
381
|
+
{:cardCode => :card_code},
|
382
|
+
{:splitTenderId => :split_tender_id},
|
383
|
+
{:approvalCode => :auth_code},
|
384
|
+
{:transId => :trans_id}
|
385
|
+
]
|
386
|
+
|
387
|
+
TRANSACTION_AUTH_FIELDS = [
|
388
|
+
{:profileTransAuthOnly => TRANSACTION_FIELDS}
|
389
|
+
]
|
390
|
+
|
391
|
+
TRANSACTION_AUTH_CAPTURE_FIELDS = [
|
392
|
+
{:profileTransAuthCapture => TRANSACTION_FIELDS}
|
393
|
+
]
|
394
|
+
|
395
|
+
TRANSACTION_CAPTURE_FIELDS = [
|
396
|
+
{:profileTransCaptureOnly => TRANSACTION_FIELDS}
|
397
|
+
]
|
398
|
+
|
399
|
+
TRANSACTION_PRIOR_AUTH_CAPTURE_FIELDS = [
|
400
|
+
{:profileTransPriorAuthCapture => TRANSACTION_FIELDS}
|
401
|
+
]
|
402
|
+
|
403
|
+
TRANSACTION_REFUND_FIELDS = [
|
404
|
+
{:profileTransRefund => TRANSACTION_FIELDS}
|
405
|
+
]
|
406
|
+
|
407
|
+
TRANSACTION_VOID_FIELDS = [
|
408
|
+
{:profileTransVoid => [
|
409
|
+
CUSTOMER_PROFILE_ID_FIELDS,
|
410
|
+
CUSTOMER_PAYMENT_PROFILE_ID_FIELDS,
|
411
|
+
{:transId => :trans_id}
|
412
|
+
]}
|
413
|
+
]
|
414
|
+
|
415
|
+
CREATE_PROFILE_FIELDS = [
|
416
|
+
REFID_FIELDS,
|
417
|
+
PROFILE_FIELDS,
|
418
|
+
VALIDATION_MODE_FIELDS
|
419
|
+
]
|
420
|
+
|
421
|
+
CREATE_PAYMENT_FIELDS = [
|
422
|
+
REFID_FIELDS,
|
423
|
+
CUSTOMER_PROFILE_ID_FIELDS,
|
424
|
+
{:paymentProfile => PAYMENT_PROFILE_FIELDS},
|
425
|
+
VALIDATION_MODE_FIELDS
|
426
|
+
]
|
427
|
+
|
428
|
+
CREATE_ADDRESS_FIELDS = [
|
429
|
+
REFID_FIELDS,
|
430
|
+
CUSTOMER_PROFILE_ID_FIELDS,
|
431
|
+
ADDRESS_FIELDS
|
432
|
+
]
|
433
|
+
|
434
|
+
CREATE_TRANSACTION_FIELDS = [
|
435
|
+
REFID_FIELDS,
|
436
|
+
{:transaction => [], :_conditional => :select_transaction_type_fields},
|
437
|
+
{:extraOptions => :extra_options}
|
438
|
+
]
|
439
|
+
|
440
|
+
DELETE_PROFILE_FIELDS = [
|
441
|
+
REFID_FIELDS,
|
442
|
+
CUSTOMER_PROFILE_ID_FIELDS
|
443
|
+
]
|
444
|
+
|
445
|
+
DELETE_PAYMENT_FIELDS = [
|
446
|
+
REFID_FIELDS,
|
447
|
+
CUSTOMER_PROFILE_ID_FIELDS,
|
448
|
+
CUSTOMER_PAYMENT_PROFILE_ID_FIELDS
|
449
|
+
]
|
450
|
+
|
451
|
+
DELETE_ADDRESS_FIELDS = [
|
452
|
+
REFID_FIELDS,
|
453
|
+
CUSTOMER_PROFILE_ID_FIELDS,
|
454
|
+
{:customerAddressId => :customer_address_id}
|
455
|
+
]
|
456
|
+
|
457
|
+
GET_PROFILE_IDS_FIELDS = []
|
458
|
+
|
459
|
+
GET_PROFILE_FIELDS = [
|
460
|
+
CUSTOMER_PROFILE_ID_FIELDS
|
461
|
+
]
|
462
|
+
|
463
|
+
GET_PAYMENT_FIELDS = [
|
464
|
+
CUSTOMER_PROFILE_ID_FIELDS,
|
465
|
+
CUSTOMER_PAYMENT_PROFILE_ID_FIELDS
|
466
|
+
]
|
467
|
+
|
468
|
+
GET_ADDRESS_FIELDS = [
|
469
|
+
CUSTOMER_PROFILE_ID_FIELDS,
|
470
|
+
{:customerAddressId => :customer_address_id}
|
471
|
+
]
|
472
|
+
|
473
|
+
UPDATE_PROFILE_FIELDS = [
|
474
|
+
REFID_FIELDS,
|
475
|
+
{:profile => [
|
476
|
+
{:merchantCustomerId => :cust_id},
|
477
|
+
{:description => :description},
|
478
|
+
{:email => :email},
|
479
|
+
CUSTOMER_PROFILE_ID_FIELDS
|
480
|
+
]}
|
481
|
+
]
|
482
|
+
|
483
|
+
UPDATE_PAYMENT_FIELDS = [
|
484
|
+
REFID_FIELDS,
|
485
|
+
CUSTOMER_PROFILE_ID_FIELDS,
|
486
|
+
{:paymentProfile => PAYMENT_PROFILE_FIELDS + [CUSTOMER_PAYMENT_PROFILE_ID_FIELDS]},
|
487
|
+
VALIDATION_MODE_FIELDS
|
488
|
+
]
|
489
|
+
|
490
|
+
UPDATE_ADDRESS_FIELDS = [
|
491
|
+
REFID_FIELDS,
|
492
|
+
CUSTOMER_PROFILE_ID_FIELDS,
|
493
|
+
{:address => [
|
494
|
+
{:firstName => :first_name},
|
495
|
+
{:lastName => :last_name},
|
496
|
+
{:company => :company},
|
497
|
+
{:address => :address},
|
498
|
+
{:city => :city},
|
499
|
+
{:state => :state},
|
500
|
+
{:zip => :zip},
|
501
|
+
{:country => :country},
|
502
|
+
{:phoneNumber => :phone},
|
503
|
+
{:faxNumber => :fax},
|
504
|
+
{:customerAddressId => :customer_address_id}
|
505
|
+
]}
|
506
|
+
]
|
507
|
+
|
508
|
+
UPDATE_SPLIT_FIELDS = [
|
509
|
+
{:splitTenderId => :split_tender_id},
|
510
|
+
{:splitTenderStatus => :split_tender_status}
|
511
|
+
]
|
512
|
+
|
513
|
+
VALIDATE_PAYMENT_FIELDS = [
|
514
|
+
CUSTOMER_PROFILE_ID_FIELDS,
|
515
|
+
CUSTOMER_PAYMENT_PROFILE_ID_FIELDS,
|
516
|
+
{:customerShippingAddressId => :customer_address_id},
|
517
|
+
{:cardCode => :card_code},
|
518
|
+
VALIDATION_MODE_FIELDS
|
519
|
+
]
|
520
|
+
|
521
|
+
FIELDS = {
|
522
|
+
AuthorizeNet::XmlTransaction::Type::CIM_CREATE_PROFILE => CREATE_PROFILE_FIELDS,
|
523
|
+
AuthorizeNet::XmlTransaction::Type::CIM_CREATE_PAYMENT => CREATE_PAYMENT_FIELDS,
|
524
|
+
AuthorizeNet::XmlTransaction::Type::CIM_CREATE_ADDRESS => CREATE_ADDRESS_FIELDS,
|
525
|
+
AuthorizeNet::XmlTransaction::Type::CIM_CREATE_TRANSACTION => CREATE_TRANSACTION_FIELDS,
|
526
|
+
AuthorizeNet::XmlTransaction::Type::CIM_DELETE_PROFILE => DELETE_PROFILE_FIELDS,
|
527
|
+
AuthorizeNet::XmlTransaction::Type::CIM_DELETE_PAYMENT => DELETE_PAYMENT_FIELDS,
|
528
|
+
AuthorizeNet::XmlTransaction::Type::CIM_DELETE_ADDRESS => DELETE_ADDRESS_FIELDS,
|
529
|
+
AuthorizeNet::XmlTransaction::Type::CIM_GET_PROFILE_IDS => GET_PROFILE_IDS_FIELDS,
|
530
|
+
AuthorizeNet::XmlTransaction::Type::CIM_GET_PROFILE => GET_PROFILE_FIELDS,
|
531
|
+
AuthorizeNet::XmlTransaction::Type::CIM_GET_PAYMENT => GET_PAYMENT_FIELDS,
|
532
|
+
AuthorizeNet::XmlTransaction::Type::CIM_GET_ADDRESS => GET_ADDRESS_FIELDS,
|
533
|
+
AuthorizeNet::XmlTransaction::Type::CIM_UPDATE_PROFILE => UPDATE_PROFILE_FIELDS,
|
534
|
+
AuthorizeNet::XmlTransaction::Type::CIM_UPDATE_PAYMENT => UPDATE_PAYMENT_FIELDS,
|
535
|
+
AuthorizeNet::XmlTransaction::Type::CIM_UPDATE_ADDRESS => UPDATE_ADDRESS_FIELDS,
|
536
|
+
AuthorizeNet::XmlTransaction::Type::CIM_UPDATE_SPLIT => UPDATE_SPLIT_FIELDS,
|
537
|
+
AuthorizeNet::XmlTransaction::Type::CIM_VALIDATE_PAYMENT => VALIDATE_PAYMENT_FIELDS
|
538
|
+
}
|
539
|
+
|
540
|
+
ADDRESS_ENTITY_DESCRIPTION = EntityDescription.new(
|
541
|
+
[
|
542
|
+
{:firstName => :first_name},
|
543
|
+
{:lastName => :last_name},
|
544
|
+
{:company => :company},
|
545
|
+
{:address => :address},
|
546
|
+
{:city => :city},
|
547
|
+
{:state => :state},
|
548
|
+
{:zip => :zip},
|
549
|
+
{:country => :country},
|
550
|
+
{:phoneNumber => :phone},
|
551
|
+
{:faxNumber => :fax}
|
552
|
+
],
|
553
|
+
AuthorizeNet::Address
|
554
|
+
)
|
555
|
+
|
556
|
+
CREDIT_CARD_ENTITY_DESCRIPTION = EntityDescription.new(
|
557
|
+
[
|
558
|
+
{:cardNumber => :card_num},
|
559
|
+
{:expirationDate => :exp_date},
|
560
|
+
{:cardCode => :card_code},
|
561
|
+
{:cardType => :card_type}
|
562
|
+
],
|
563
|
+
AuthorizeNet::CreditCard,
|
564
|
+
[:card_num, :exp_date]
|
565
|
+
)
|
566
|
+
|
567
|
+
ECHECK_ENTITY_DESCRIPTION = EntityDescription.new(
|
568
|
+
[
|
569
|
+
{:accountType => :account_type},
|
570
|
+
{:routingNumber => :routing_number},
|
571
|
+
{:accountNumber => :account_number},
|
572
|
+
{:nameOnAccount => :account_holder_name},
|
573
|
+
{:echeckType => :echeck_type},
|
574
|
+
{:bankName => :bank_name}
|
575
|
+
],
|
576
|
+
AuthorizeNet::ECheck,
|
577
|
+
[:routing_number, :account_number, :bank_name, :account_holder_name]
|
578
|
+
)
|
579
|
+
|
580
|
+
PAYMENT_PROFILE_ENTITY_DESCRIPTION = EntityDescription.new(
|
581
|
+
[
|
582
|
+
CUSTOMER_PAYMENT_PROFILE_ID_FIELDS,
|
583
|
+
{:customerType => :cust_type},
|
584
|
+
{:billTo => ADDRESS_ENTITY_DESCRIPTION, :_value => :billing_address},
|
585
|
+
{:payment => [
|
586
|
+
{:creditCard => CREDIT_CARD_ENTITY_DESCRIPTION, :_value => :payment_method},
|
587
|
+
{:bankAccount => ECHECK_ENTITY_DESCRIPTION, :_value => :payment_method}
|
588
|
+
]}
|
589
|
+
],
|
590
|
+
AuthorizeNet::CIM::PaymentProfile
|
591
|
+
)
|
592
|
+
|
593
|
+
PROFILE_ENTITY_DESCRIPTION = EntityDescription.new(
|
594
|
+
[
|
595
|
+
{:merchantCustomerId => :id},
|
596
|
+
{:description => :description},
|
597
|
+
{:email => :email},
|
598
|
+
CUSTOMER_PROFILE_ID_FIELDS,
|
599
|
+
{:paymentProfiles => PAYMENT_PROFILE_ENTITY_DESCRIPTION, :_multivalue => :payment_profiles},
|
600
|
+
{:shipTo => ADDRESS_ENTITY_DESCRIPTION, :_multivalue => :addresses}
|
601
|
+
],
|
602
|
+
AuthorizeNet::CIM::CustomerProfile
|
603
|
+
)
|
604
|
+
end
|
605
|
+
end
|
606
|
+
|
607
|
+
module Reporting
|
608
|
+
module Fields
|
609
|
+
|
610
|
+
GET_BATCH_LIST = [
|
611
|
+
{:includeStatistics => :include_statistics},
|
612
|
+
{:firstSettlementDate => :first_settlement_date},
|
613
|
+
{:lastSettlementDate => :last_settlement_date}
|
614
|
+
]
|
615
|
+
|
616
|
+
GET_TRANSACTION_LIST = [
|
617
|
+
{:batchId => :batch_id}
|
618
|
+
]
|
619
|
+
|
620
|
+
GET_TRANSACTION_DETAILS = [
|
621
|
+
{:transId => :transaction_id}
|
622
|
+
]
|
623
|
+
|
624
|
+
BATCH_STATISTICS_ENTITY_DESCRIPTION = EntityDescription.new([
|
625
|
+
{:accountType => :account_type},
|
626
|
+
{:chargeAmount => :charge_amount, :_converter => :value_to_decimal},
|
627
|
+
{:chargeCount => :charge_count, :_converter => :value_to_integer},
|
628
|
+
{:refundAmount => :refund_amount, :_converter => :value_to_decimal},
|
629
|
+
{:refundCount => :refund_count, :_converter => :value_to_integer},
|
630
|
+
{:voidCount => :void_count, :_converter => :value_to_integer},
|
631
|
+
{:declineCount => :decline_count, :_converter => :value_to_integer},
|
632
|
+
{:errorCount => :error_count, :_converter => :value_to_integer},
|
633
|
+
{:returnedItemAmount => :returned_item_amount, :_converter => :value_to_decimal},
|
634
|
+
{:returnedItemCount => :returned_item_count, :_converter => :value_to_integer},
|
635
|
+
{:chargebackAmount => :chargeback_amount, :_converter => :value_to_decimal},
|
636
|
+
{:chargebackCount => :chargeback_count, :_converter => :value_to_integer},
|
637
|
+
{:correctionNoticeCount => :correction_notice_count, :_converter => :value_to_integer},
|
638
|
+
{:chargeChargeBackAmount => :charge_chargeback_amount, :_converter => :value_to_decimal},
|
639
|
+
{:chargeChargeBackCount => :charge_chargeback_count, :_converter => :value_to_integer},
|
640
|
+
{:refundChargeBackAmount => :refund_chargeback_amount, :_converter => :value_to_decimal},
|
641
|
+
{:refundChargeBackCount => :refund_chargeback_count, :_converter => :value_to_integer},
|
642
|
+
{:chargeReturnedItemsAmount => :charge_returned_items_amount, :_converter => :value_to_decimal},
|
643
|
+
{:chargeReturnedItemsCount => :charge_returned_items_count, :_converter => :value_to_integer},
|
644
|
+
{:refundReturnedItemsAmount => :refund_returned_items_amount, :_converter => :value_to_decimal},
|
645
|
+
{:refundReturnedItemsCount => :refund_returned_items_count, :_converter => :value_to_integer}
|
646
|
+
],
|
647
|
+
AuthorizeNet::Reporting::BatchStatistics
|
648
|
+
)
|
649
|
+
|
650
|
+
BATCH_ENTITY_DESCRIPTION = EntityDescription.new([
|
651
|
+
{:batchId => :id},
|
652
|
+
{:settlementTimeUTC => :settled_at, :_converter => :value_to_datetime},
|
653
|
+
{:settlementState => :state},
|
654
|
+
{:paymentMethod => :payment_method},
|
655
|
+
{:statistics => [{:statistic => BATCH_STATISTICS_ENTITY_DESCRIPTION, :_multivalue => :statistics}]}
|
656
|
+
],
|
657
|
+
AuthorizeNet::Reporting::Batch
|
658
|
+
)
|
659
|
+
|
660
|
+
FDSFILTER_ENTITY_DESCRIPTION = EntityDescription.new([
|
661
|
+
{:name => :name},
|
662
|
+
{:action => :action}
|
663
|
+
],
|
664
|
+
AuthorizeNet::Reporting::FDSFilter
|
665
|
+
)
|
666
|
+
|
667
|
+
CUSTOMER_ENTITY_DESCRIPTION = EntityDescription.new([
|
668
|
+
{:id => :id},
|
669
|
+
{:email => :email}
|
670
|
+
],
|
671
|
+
AuthorizeNet::CIM::CustomerProfile
|
672
|
+
)
|
673
|
+
|
674
|
+
ORDER_ENTITY_DESCRIPTION = EntityDescription.new([
|
675
|
+
{:invoice_number => :invoice_num},
|
676
|
+
{:description => :description},
|
677
|
+
{:purchaseOrderNumber => :po_num}
|
678
|
+
],
|
679
|
+
AuthorizeNet::Order
|
680
|
+
)
|
681
|
+
|
682
|
+
LINE_ITEM_ENTITY_DESCRIPTION = EntityDescription.new([
|
683
|
+
{:itemId => :id},
|
684
|
+
{:name => :name},
|
685
|
+
{:description => :description},
|
686
|
+
{:quantity => :quantity, :_convert => :value_to_integer},
|
687
|
+
{:unityPrice => :price, :_convert => :value_to_decimal},
|
688
|
+
{:taxable => :taxable, :_convert => :value_to_boolean}
|
689
|
+
],
|
690
|
+
AuthorizeNet::LineItem
|
691
|
+
)
|
692
|
+
|
693
|
+
TRANSACTION_DETAILS_ENTITY_DESCRIPTION = EntityDescription.new([
|
694
|
+
{:transId => :id},
|
695
|
+
{:refTransId => :reference_id},
|
696
|
+
{:splitTenderId => :split_tender_id},
|
697
|
+
{:transactionType => :type},
|
698
|
+
{:responseCode => :response_code},
|
699
|
+
{:responseReasonCode => :response_reason_code},
|
700
|
+
{:authCode => :auth_code},
|
701
|
+
{:AVSResponse => :avs_response},
|
702
|
+
{:cardCodeResponse => :card_code_response},
|
703
|
+
{:CAVVResponse => :cavv_response},
|
704
|
+
{:FDSFilterAction => :fds_filter_action},
|
705
|
+
{:FDSFilters => [{:FDSFilter => FDSFILTER_ENTITY_DESCRIPTION, :_multivalue => :fds_filters}]},
|
706
|
+
{:batch => BATCH_ENTITY_DESCRIPTION, :_value => :batch},
|
707
|
+
{:responseReasonDescription => :response_reason_description},
|
708
|
+
{:submitTimeUTC => :submitted_at, :_converter => :value_to_datetime},
|
709
|
+
{:transactionStatus => :status},
|
710
|
+
{:accountType => :account_type},
|
711
|
+
{:accountNumber => :account_number},
|
712
|
+
{:order => ORDER_ENTITY_DESCRIPTION, :_value => :order},
|
713
|
+
{:requestedAmount => :requested_amount, :_converter => :value_to_decimal},
|
714
|
+
{:authAmount => :auth_amount, :_converter => :value_to_decimal},
|
715
|
+
{:settleAmount => :settle_amount, :_converter => :value_to_decimal},
|
716
|
+
{:prepaidBalanceRemaining => :prepaid_balance_remaining, :_converter => :value_to_decimal},
|
717
|
+
{:payment => [
|
718
|
+
{:creditCard => AuthorizeNet::CIM::Fields::CREDIT_CARD_ENTITY_DESCRIPTION, :_value => :payment_method},
|
719
|
+
{:bankAccount => AuthorizeNet::CIM::Fields::ECHECK_ENTITY_DESCRIPTION, :_value => :payment_method}
|
720
|
+
]},
|
721
|
+
{:customer => CUSTOMER_ENTITY_DESCRIPTION, :_value => :customer},
|
722
|
+
{:billTo => AuthorizeNet::CIM::Fields::ADDRESS_ENTITY_DESCRIPTION, :_value => :bill_to},
|
723
|
+
{:shipTo => AuthorizeNet::CIM::Fields::ADDRESS_ENTITY_DESCRIPTION, :_value => :ship_to},
|
724
|
+
{:recurringBilling => :recurring_billing, :_convert => :value_to_boolean}
|
725
|
+
],
|
726
|
+
AuthorizeNet::Reporting::TransactionDetails
|
727
|
+
)
|
728
|
+
|
729
|
+
FIELDS = {
|
730
|
+
AuthorizeNet::XmlTransaction::Type::REPORT_GET_BATCH_LIST => GET_BATCH_LIST,
|
731
|
+
AuthorizeNet::XmlTransaction::Type::REPORT_GET_TRANSACTION_LIST => GET_TRANSACTION_LIST,
|
732
|
+
AuthorizeNet::XmlTransaction::Type::REPORT_GET_TRANSACTION_DETAILS => GET_TRANSACTION_DETAILS
|
733
|
+
}
|
734
|
+
end
|
735
|
+
end
|
736
|
+
end
|