authorizenet 1.8.7 → 1.8.8

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