authorizenet 1.9.4 → 2.0.1
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 +5 -5
- data/lib/app/helpers/authorize_net_helper.rb +2 -3
- data/lib/authorize_net.rb +11 -56
- data/lib/authorize_net/api/LogHelper.rb +97 -0
- data/lib/authorize_net/api/SensitiveDataFilter.rb +92 -0
- data/lib/authorize_net/api/api_transaction.rb +95 -90
- data/lib/authorize_net/api/constants.yml +1 -1
- data/lib/authorize_net/api/schema.rb +1353 -994
- data/lib/authorize_net/api/transaction.rb +104 -102
- data/lib/authorize_net/authorize_net.rb +20 -27
- data/lib/authorize_net/response.rb +9 -15
- data/lib/authorize_net/transaction.rb +18 -26
- data/lib/authorize_net/xml_response.rb +36 -54
- data/lib/authorize_net/xml_transaction.rb +115 -134
- metadata +59 -73
- data/lib/authorize_net/addresses/address.rb +0 -29
- data/lib/authorize_net/addresses/shipping_address.rb +0 -26
- data/lib/authorize_net/aim/response.rb +0 -131
- data/lib/authorize_net/aim/transaction.rb +0 -190
- data/lib/authorize_net/arb/fields.rb +0 -24
- data/lib/authorize_net/arb/paging.rb +0 -33
- data/lib/authorize_net/arb/response.rb +0 -34
- data/lib/authorize_net/arb/sorting.rb +0 -43
- data/lib/authorize_net/arb/subscription.rb +0 -72
- data/lib/authorize_net/arb/subscription_detail.rb +0 -14
- data/lib/authorize_net/arb/subscription_list_response.rb +0 -43
- data/lib/authorize_net/arb/transaction.rb +0 -177
- data/lib/authorize_net/cim/customer_profile.rb +0 -19
- data/lib/authorize_net/cim/payment_profile.rb +0 -37
- data/lib/authorize_net/cim/response.rb +0 -116
- data/lib/authorize_net/cim/transaction.rb +0 -727
- data/lib/authorize_net/customer.rb +0 -27
- data/lib/authorize_net/email_receipt.rb +0 -24
- data/lib/authorize_net/fields.rb +0 -779
- data/lib/authorize_net/key_value_response.rb +0 -117
- data/lib/authorize_net/key_value_transaction.rb +0 -291
- data/lib/authorize_net/line_item.rb +0 -25
- data/lib/authorize_net/order.rb +0 -42
- data/lib/authorize_net/payment_methods/credit_card.rb +0 -62
- data/lib/authorize_net/payment_methods/echeck.rb +0 -72
- data/lib/authorize_net/reporting/batch.rb +0 -19
- data/lib/authorize_net/reporting/batch_statistics.rb +0 -19
- data/lib/authorize_net/reporting/fds_filter.rb +0 -11
- data/lib/authorize_net/reporting/response.rb +0 -163
- data/lib/authorize_net/reporting/returned_item.rb +0 -46
- data/lib/authorize_net/reporting/transaction.rb +0 -133
- data/lib/authorize_net/reporting/transaction_details.rb +0 -25
- data/lib/authorize_net/sim/hosted_payment_form.rb +0 -38
- data/lib/authorize_net/sim/hosted_receipt_page.rb +0 -37
- data/lib/authorize_net/sim/response.rb +0 -142
- data/lib/authorize_net/sim/transaction.rb +0 -138
- data/lib/generators/authorize_net/direct_post/direct_post_generator.rb +0 -53
- data/lib/generators/authorize_net/direct_post/templates/README-AuthorizeNet +0 -49
- data/lib/generators/authorize_net/direct_post/templates/config.yml.erb +0 -8
- data/lib/generators/authorize_net/direct_post/templates/config.yml.rails3.erb +0 -8
- data/lib/generators/authorize_net/direct_post/templates/controller.rb.erb +0 -31
- data/lib/generators/authorize_net/direct_post/templates/initializer.rb +0 -4
- data/lib/generators/authorize_net/direct_post/templates/layout.erb +0 -18
- data/lib/generators/authorize_net/direct_post/templates/payment.erb +0 -10
- data/lib/generators/authorize_net/direct_post/templates/payment.rails3.erb +0 -10
- data/lib/generators/authorize_net/direct_post/templates/receipt.erb +0 -1
- data/lib/generators/authorize_net/direct_post/templates/relay_response.erb +0 -1
- data/lib/generators/authorize_net/sim/sim_generator.rb +0 -47
- data/lib/generators/authorize_net/sim/templates/README-AuthorizeNet +0 -52
- data/lib/generators/authorize_net/sim/templates/config.yml.erb +0 -8
- data/lib/generators/authorize_net/sim/templates/config.yml.rails3.erb +0 -8
- data/lib/generators/authorize_net/sim/templates/controller.rb.erb +0 -21
- data/lib/generators/authorize_net/sim/templates/initializer.rb +0 -4
- data/lib/generators/authorize_net/sim/templates/layout.erb +0 -18
- data/lib/generators/authorize_net/sim/templates/payment.erb +0 -6
- data/lib/generators/authorize_net/sim/templates/payment.rails3.erb +0 -6
- data/lib/generators/authorize_net/sim/templates/thank_you.erb +0 -1
- data/lib/generators/generator_extensions.rb +0 -75
@@ -1,263 +1,265 @@
|
|
1
1
|
module AuthorizeNet::API
|
2
|
-
class Transaction < ApiTransaction
|
2
|
+
class Transaction < ApiTransaction
|
3
3
|
attr_accessor :access_token
|
4
|
-
|
5
|
-
|
4
|
+
attr_accessor :options_OAuth
|
5
|
+
|
6
6
|
def initialize(api_login_id = nil, api_transaction_key = nil, options = {})
|
7
|
-
|
7
|
+
super
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
# This request enables you to create a transaction, and optional
|
11
11
|
# customer profile.
|
12
12
|
# NOTE: Network tokenized transactions (e.g. Apple Pay), or PayPal should
|
13
13
|
# not be used to create payment profiles.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# See spec/api_spec.rb for usage examples
|
16
|
-
def create_transaction(request)
|
17
|
-
make_request(request,CreateTransactionResponse,Type::API_CREATE_TRANSACTION)
|
16
|
+
def create_transaction(request)
|
17
|
+
make_request(request, CreateTransactionResponse, Type::API_CREATE_TRANSACTION)
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
# This request enables you to create a recurring billing subscription.
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# See spec/api_spec.rb for usage examples
|
23
23
|
def create_subscription(request)
|
24
|
-
make_request(request,ARBCreateSubscriptionResponse,Type::API_CREATE_SUBSCRIPTION)
|
24
|
+
make_request(request, ARBCreateSubscriptionResponse, Type::API_CREATE_SUBSCRIPTION)
|
25
25
|
end
|
26
26
|
|
27
27
|
# This request enables you to update a recurring billing subscription.
|
28
|
-
#
|
28
|
+
#
|
29
29
|
# See spec/api_spec.rb for usage examples
|
30
30
|
def update_subscription(request)
|
31
|
-
make_request(request,ARBUpdateSubscriptionResponse,Type::API_UPDATE_SUBSCRIPTION)
|
31
|
+
make_request(request, ARBUpdateSubscriptionResponse, Type::API_UPDATE_SUBSCRIPTION)
|
32
32
|
end
|
33
33
|
|
34
34
|
# This request enables you to cancel a recurring billing subscription.
|
35
|
-
#
|
35
|
+
#
|
36
36
|
# See spec/api_spec.rb for usage examples
|
37
37
|
def cancel_subscription(request)
|
38
|
-
make_request(request,ARBCancelSubscriptionResponse,Type::API_CANCEL_SUBSCRIPTION)
|
38
|
+
make_request(request, ARBCancelSubscriptionResponse, Type::API_CANCEL_SUBSCRIPTION)
|
39
39
|
end
|
40
40
|
|
41
41
|
# This request enables you to get a recurring billing subscription status.
|
42
|
-
#
|
42
|
+
#
|
43
43
|
# See spec/api_spec.rb for usage examples
|
44
44
|
def get_subscription_status(request)
|
45
|
-
make_request(request,ARBGetSubscriptionStatusResponse,Type::API_GET_SUBSCRIPTION_STATUS)
|
45
|
+
make_request(request, ARBGetSubscriptionStatusResponse, Type::API_GET_SUBSCRIPTION_STATUS)
|
46
46
|
end
|
47
47
|
|
48
48
|
# This request enables you to get a list of all recurring billing
|
49
49
|
# subscriptions.
|
50
|
-
#
|
50
|
+
#
|
51
51
|
# See spec/api_spec.rb for usage examples
|
52
52
|
def get_subscription_list(request)
|
53
|
-
make_request(request,ARBGetSubscriptionListResponse,Type::API_GET_SUBSCRIPTION_LIST)
|
53
|
+
make_request(request, ARBGetSubscriptionListResponse, Type::API_GET_SUBSCRIPTION_LIST)
|
54
54
|
end
|
55
55
|
|
56
56
|
# This request enables you to create a customer profile.
|
57
|
-
#
|
57
|
+
#
|
58
58
|
# See spec/api_spec.rb for usage examples
|
59
59
|
def create_customer_profile(request)
|
60
|
-
make_request(request,CreateCustomerProfileResponse,Type::API_CREATE_CUSTOMER_PROFILE)
|
60
|
+
make_request(request, CreateCustomerProfileResponse, Type::API_CREATE_CUSTOMER_PROFILE)
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
# This request enables you to retrieve a customer profile.
|
64
|
-
#
|
64
|
+
#
|
65
65
|
# See spec/api_spec.rb for usage examples
|
66
66
|
def get_customer_profile(request)
|
67
|
-
make_request(request,GetCustomerProfileResponse,Type::API_GET_CUSTOMER_PROFILE)
|
67
|
+
make_request(request, GetCustomerProfileResponse, Type::API_GET_CUSTOMER_PROFILE)
|
68
68
|
end
|
69
69
|
|
70
|
-
|
71
70
|
# This request enables you to retrieve all customer profile IDs.
|
72
|
-
#
|
71
|
+
#
|
73
72
|
# See spec/api_spec.rb for usage examples
|
74
73
|
def get_customer_profile_ids(request)
|
75
|
-
make_request(request,GetCustomerProfileIdsResponse,Type::API_GET_CUSTOMER_PROFILE_IDS)
|
74
|
+
make_request(request, GetCustomerProfileIdsResponse, Type::API_GET_CUSTOMER_PROFILE_IDS)
|
76
75
|
end
|
77
76
|
|
78
77
|
# This request enables you to update a customer profile.
|
79
|
-
#
|
78
|
+
#
|
80
79
|
# See spec/api_spec.rb for usage examples
|
81
80
|
def update_customer_profile(request)
|
82
|
-
make_request(request,UpdateCustomerProfileResponse,Type::API_UPDATE_CUSTOMER_PROFILE)
|
81
|
+
make_request(request, UpdateCustomerProfileResponse, Type::API_UPDATE_CUSTOMER_PROFILE)
|
83
82
|
end
|
84
83
|
|
85
84
|
# This request enables you to delete a customer profile.
|
86
|
-
#
|
85
|
+
#
|
87
86
|
# See spec/api_spec.rb for usage examples
|
88
87
|
def delete_customer_profile(request)
|
89
|
-
make_request(request,DeleteCustomerProfileResponse,Type::API_DELETE_CUSTOMER_PROFILE)
|
88
|
+
make_request(request, DeleteCustomerProfileResponse, Type::API_DELETE_CUSTOMER_PROFILE)
|
90
89
|
end
|
91
|
-
|
90
|
+
|
92
91
|
# This request enables you to create a customer payment profile.
|
93
|
-
#
|
92
|
+
#
|
94
93
|
# See spec/api_spec.rb for usage examples
|
95
94
|
def create_customer_payment_profile(request)
|
96
|
-
make_request(request,CreateCustomerPaymentProfileResponse,Type::API_CREATE_CUSTOMER_PAYMENT_PROFILE)
|
95
|
+
make_request(request, CreateCustomerPaymentProfileResponse, Type::API_CREATE_CUSTOMER_PAYMENT_PROFILE)
|
97
96
|
end
|
98
|
-
|
97
|
+
|
99
98
|
# This request enables you to retrieve a customer payment profile.
|
100
|
-
#
|
99
|
+
#
|
101
100
|
# See spec/api_spec.rb for usage examples
|
102
101
|
def get_customer_payment_profile(request)
|
103
|
-
make_request(request,GetCustomerPaymentProfileResponse,Type::API_GET_CUSTOMER_PAYMENT_PROFILE)
|
102
|
+
make_request(request, GetCustomerPaymentProfileResponse, Type::API_GET_CUSTOMER_PAYMENT_PROFILE)
|
104
103
|
end
|
105
104
|
|
106
105
|
# This request enables you to update a customer payment profile.
|
107
|
-
#
|
106
|
+
#
|
108
107
|
# See spec/api_spec.rb for usage examples
|
109
108
|
def update_customer_payment_profile(request)
|
110
|
-
make_request(request,UpdateCustomerPaymentProfileResponse,Type::API_UPDATE_CUSTOMER_PAYMENT_PROFILE)
|
109
|
+
make_request(request, UpdateCustomerPaymentProfileResponse, Type::API_UPDATE_CUSTOMER_PAYMENT_PROFILE)
|
111
110
|
end
|
112
111
|
|
113
112
|
# This request enables you to delete a customer payment profile.
|
114
|
-
#
|
113
|
+
#
|
115
114
|
# See spec/api_spec.rb for usage examples
|
116
115
|
def delete_customer_payment_profile(request)
|
117
|
-
make_request(request,DeleteCustomerPaymentProfileResponse,Type::API_DELETE_CUSTOMER_PAYMENT_PROFILE)
|
116
|
+
make_request(request, DeleteCustomerPaymentProfileResponse, Type::API_DELETE_CUSTOMER_PAYMENT_PROFILE)
|
118
117
|
end
|
119
118
|
|
120
119
|
# This request enables you to create a customer shipping profile.
|
121
|
-
#
|
120
|
+
#
|
122
121
|
# See spec/api_spec.rb for usage examples
|
123
122
|
def create_customer_shipping_profile(request)
|
124
|
-
make_request(request,CreateCustomerShippingAddressResponse,Type::API_CREATE_CUSTOMER_SHIPPING_PROFILE)
|
123
|
+
make_request(request, CreateCustomerShippingAddressResponse, Type::API_CREATE_CUSTOMER_SHIPPING_PROFILE)
|
125
124
|
end
|
126
|
-
|
125
|
+
|
127
126
|
# This request enables you to retrieve a customer shipping profile.
|
128
|
-
#
|
127
|
+
#
|
129
128
|
# See spec/api_spec.rb for usage examples
|
130
129
|
def get_customer_shipping_profile(request)
|
131
|
-
make_request(request,GetCustomerShippingAddressResponse,Type::API_GET_CUSTOMER_SHIPPING_PROFILE)
|
130
|
+
make_request(request, GetCustomerShippingAddressResponse, Type::API_GET_CUSTOMER_SHIPPING_PROFILE)
|
132
131
|
end
|
133
132
|
|
134
133
|
# This request enables you to update a customer shipping profile.
|
135
|
-
#
|
134
|
+
#
|
136
135
|
# See spec/api_spec.rb for usage examples
|
137
136
|
def update_customer_shipping_profile(request)
|
138
|
-
make_request(request,UpdateCustomerShippingAddressResponse,Type::API_UPDATE_CUSTOMER_SHIPPING_PROFILE)
|
137
|
+
make_request(request, UpdateCustomerShippingAddressResponse, Type::API_UPDATE_CUSTOMER_SHIPPING_PROFILE)
|
139
138
|
end
|
140
139
|
|
141
140
|
# This request enables you to delete a customer shipping profile.
|
142
|
-
#
|
141
|
+
#
|
143
142
|
# See spec/api_spec.rb for usage examples
|
144
143
|
def delete_customer_shipping_profile(request)
|
145
|
-
make_request(request,DeleteCustomerShippingAddressResponse,Type::API_DELETE_CUSTOMER_SHIPPING_PROFILE)
|
144
|
+
make_request(request, DeleteCustomerShippingAddressResponse, Type::API_DELETE_CUSTOMER_SHIPPING_PROFILE)
|
146
145
|
end
|
147
|
-
|
148
146
|
|
149
147
|
# This request enables you to create a customer profile, payment
|
150
148
|
# profile, and shipping profile from an existing successful transaction.
|
151
149
|
# NOTE: Network tokenized transactions (e.g. Apple Pay), or PayPal
|
152
150
|
# should not be used to create payment profiles.
|
153
|
-
#
|
151
|
+
#
|
154
152
|
# See spec/api_spec.rb for usage examples
|
155
153
|
def create_customer_profile_from_transaction(request)
|
156
|
-
make_request(request,CreateProfileResponse,Type::API_CREATE_CUSTOMER_PROFILE_FROM_TRANSACTION)
|
154
|
+
make_request(request, CreateProfileResponse, Type::API_CREATE_CUSTOMER_PROFILE_FROM_TRANSACTION)
|
157
155
|
end
|
158
156
|
|
159
157
|
# This request enables you to decrypt a payment data blob.
|
160
|
-
#
|
158
|
+
#
|
161
159
|
# See spec/api_spec.rb for usage examples
|
162
160
|
def decrypt_payment_data(request)
|
163
|
-
make_request(request,DecryptPaymentDataResponse,Type::API_DECRYPT_PAYMENT_DATA)
|
161
|
+
make_request(request, DecryptPaymentDataResponse, Type::API_DECRYPT_PAYMENT_DATA)
|
164
162
|
end
|
165
163
|
|
166
164
|
# This request enables confirm authentication values.
|
167
|
-
#
|
165
|
+
#
|
168
166
|
# See spec/api_spec.rb for usage examples
|
169
|
-
def authenticate_test_request(request)
|
170
|
-
make_request(request,AuthenticateTestResponse,Type::API_AUTHENTICATE_TEST_REQUEST)
|
167
|
+
def authenticate_test_request(request)
|
168
|
+
make_request(request, AuthenticateTestResponse, Type::API_AUTHENTICATE_TEST_REQUEST)
|
171
169
|
end
|
172
|
-
|
170
|
+
|
173
171
|
# This request enables you to get batch statistics details.
|
174
|
-
#
|
172
|
+
#
|
175
173
|
# See spec/api_spec.rb for usage examples
|
176
|
-
def get_batch_statistics(request)
|
177
|
-
make_request(request,GetBatchStatisticsResponse,Type::API_GET_BATCH_STATISTICS)
|
174
|
+
def get_batch_statistics(request)
|
175
|
+
make_request(request, GetBatchStatisticsResponse, Type::API_GET_BATCH_STATISTICS)
|
178
176
|
end
|
179
177
|
|
180
178
|
# This request enables you to get batch transaction details.
|
181
|
-
#
|
179
|
+
#
|
182
180
|
# See spec/api_spec.rb for usage examples
|
183
|
-
def get_transaction_details(request)
|
184
|
-
make_request(request,GetTransactionDetailsResponse,Type::API_GET_TRANSACTION_DETAILS)
|
181
|
+
def get_transaction_details(request)
|
182
|
+
make_request(request, GetTransactionDetailsResponse, Type::API_GET_TRANSACTION_DETAILS)
|
185
183
|
end
|
186
184
|
|
187
185
|
# This request enables you to get batch settled transaction details.
|
188
|
-
#
|
186
|
+
#
|
189
187
|
# See spec/api_spec.rb for usage examples
|
190
|
-
def get_settled_batch_list(request)
|
191
|
-
make_request(request,GetSettledBatchListResponse,Type::API_GET_SETTLED_BATCH_LIST)
|
188
|
+
def get_settled_batch_list(request)
|
189
|
+
make_request(request, GetSettledBatchListResponse, Type::API_GET_SETTLED_BATCH_LIST)
|
192
190
|
end
|
193
191
|
|
194
192
|
# This request enables you to get batch unsettled transaction details.
|
195
|
-
#
|
193
|
+
#
|
196
194
|
# See spec/api_spec.rb for usage examples
|
197
|
-
def get_unsettled_transaction_list(request)
|
198
|
-
make_request(request,GetUnsettledTransactionListResponse,Type::API_GET_UNSETTLED_TRANSACTION_LIST)
|
195
|
+
def get_unsettled_transaction_list(request)
|
196
|
+
make_request(request, GetUnsettledTransactionListResponse, Type::API_GET_UNSETTLED_TRANSACTION_LIST)
|
199
197
|
end
|
200
|
-
|
201
|
-
|
202
|
-
#
|
198
|
+
|
199
|
+
# This request enables confirm authentication values.
|
200
|
+
#
|
203
201
|
# See spec/api_spec.rb for usage examples
|
204
|
-
def get_hosted_profile_page(request)
|
205
|
-
make_request(request,GetHostedProfilePageResponse,Type::API_GET_HOSTED_PROFILE_PAGE)
|
202
|
+
def get_hosted_profile_page(request)
|
203
|
+
make_request(request, GetHostedProfilePageResponse, Type::API_GET_HOSTED_PROFILE_PAGE)
|
206
204
|
end
|
207
|
-
|
205
|
+
|
208
206
|
# This request enables you to update split tender group.
|
209
|
-
#
|
207
|
+
#
|
210
208
|
# See spec/api_spec.rb for usage examples
|
211
|
-
def update_split_tender_group(request)
|
212
|
-
make_request(request,UpdateSplitTenderGroupResponse,Type::API_UPDATE_SPLIT_TENDER_GROUP)
|
209
|
+
def update_split_tender_group(request)
|
210
|
+
make_request(request, UpdateSplitTenderGroupResponse, Type::API_UPDATE_SPLIT_TENDER_GROUP)
|
213
211
|
end
|
214
|
-
|
212
|
+
|
215
213
|
# This request enables you to get customer payment profile list.
|
216
|
-
#
|
214
|
+
#
|
217
215
|
# See spec/api_spec.rb for usage examples
|
218
|
-
def get_customer_payment_profile_list(request)
|
219
|
-
make_request(request,GetCustomerPaymentProfileListResponse,Type::API_GET_CUSTOMER_PAYMENT_PROFILE_LIST)
|
216
|
+
def get_customer_payment_profile_list(request)
|
217
|
+
make_request(request, GetCustomerPaymentProfileListResponse, Type::API_GET_CUSTOMER_PAYMENT_PROFILE_LIST)
|
220
218
|
end
|
221
|
-
|
219
|
+
|
222
220
|
# This request enables you to get ARB Subscription.
|
223
|
-
#
|
221
|
+
#
|
224
222
|
# See spec/api_spec.rb for usage examples
|
225
|
-
def arb_get_subscription_request(request)
|
226
|
-
make_request(request,ARBGetSubscriptionResponse,Type::API_ARB_GET_SUBSCRIPTION_REQUEST)
|
223
|
+
def arb_get_subscription_request(request)
|
224
|
+
make_request(request, ARBGetSubscriptionResponse, Type::API_ARB_GET_SUBSCRIPTION_REQUEST)
|
227
225
|
end
|
228
226
|
|
229
227
|
# This request enables you to get transaction list.
|
230
228
|
#
|
231
229
|
# See spec/api_spec.rb for usage examples
|
232
230
|
def get_transaction_list(request)
|
233
|
-
make_request(request,GetTransactionListResponse,Type::API_GET_TRANSACTION_LIST)
|
231
|
+
make_request(request, GetTransactionListResponse, Type::API_GET_TRANSACTION_LIST)
|
234
232
|
end
|
235
|
-
|
233
|
+
|
236
234
|
# This request enables you to validate customer payment profile.
|
237
|
-
#
|
235
|
+
#
|
238
236
|
# See spec/api_spec.rb for usage examples
|
239
|
-
def validate_customer_payment_profile(request)
|
240
|
-
make_request(request,ValidateCustomerPaymentProfileResponse,Type::API_VALIDATE_CUSTOMER_PAYMENT_PROFILE)
|
237
|
+
def validate_customer_payment_profile(request)
|
238
|
+
make_request(request, ValidateCustomerPaymentProfileResponse, Type::API_VALIDATE_CUSTOMER_PAYMENT_PROFILE)
|
241
239
|
end
|
242
240
|
|
243
|
-
def get_merchant_details(request)
|
244
|
-
make_request(request,GetMerchantDetailsResponse,Type::API_GET_MERCHANT_DETAILS)
|
241
|
+
def get_merchant_details(request)
|
242
|
+
make_request(request, GetMerchantDetailsResponse, Type::API_GET_MERCHANT_DETAILS)
|
245
243
|
end
|
246
244
|
|
247
|
-
def get_hosted_payment_page(request)
|
248
|
-
make_request(request,GetHostedPaymentPageResponse,Type::API_GET_HOSTED_PAYMENT_PAGE)
|
245
|
+
def get_hosted_payment_page(request)
|
246
|
+
make_request(request, GetHostedPaymentPageResponse, Type::API_GET_HOSTED_PAYMENT_PAGE)
|
249
247
|
end
|
250
248
|
|
251
|
-
def update_held_transaction(request)
|
252
|
-
make_request(request,UpdateHeldTransactionResponse,Type::API_UDPATE_HELD_TRANSACTION)
|
249
|
+
def update_held_transaction(request)
|
250
|
+
make_request(request, UpdateHeldTransactionResponse, Type::API_UDPATE_HELD_TRANSACTION)
|
253
251
|
end
|
254
252
|
|
255
253
|
def get_transaction_list_for_customer(request)
|
256
|
-
make_request(request,GetTransactionListResponse,Type::API_GET_TRANSACTION_LIST_FOR_CUSTOMER)
|
254
|
+
make_request(request, GetTransactionListResponse, Type::API_GET_TRANSACTION_LIST_FOR_CUSTOMER)
|
257
255
|
end
|
258
|
-
|
256
|
+
|
259
257
|
def update_merchant_details(request)
|
260
|
-
make_request(request,UpdateMerchantDetailsResponse,Type::API_UPDATE_MERCHANT_DETAILS)
|
258
|
+
make_request(request, UpdateMerchantDetailsResponse, Type::API_UPDATE_MERCHANT_DETAILS)
|
259
|
+
end
|
260
|
+
|
261
|
+
def get_customer_payment_profile_nonce(request)
|
262
|
+
make_request(request, GetCustomerPaymentProfileNonceResponse, Type::API_GET_CUSTOMER_PAYMENT_PROFILE_NONCE)
|
261
263
|
end
|
262
264
|
end
|
263
265
|
end
|
@@ -2,12 +2,10 @@
|
|
2
2
|
# The core AuthoizeNet module.
|
3
3
|
# The entire SDK is name-spaced inside of this module.
|
4
4
|
module AuthorizeNet
|
5
|
-
|
6
5
|
# Some type conversion routines that will be injected into our
|
7
6
|
# Transaction/Response classes.
|
8
7
|
module TypeConversions
|
9
|
-
|
10
|
-
API_FIELD_PREFIX = 'x_'
|
8
|
+
API_FIELD_PREFIX = 'x_'.freeze
|
11
9
|
|
12
10
|
# Converts a value received from Authorize.Net into a boolean if
|
13
11
|
# possible. This is designed to handle the wide range of boolean
|
@@ -22,7 +20,7 @@ module AuthorizeNet
|
|
22
20
|
value
|
23
21
|
end
|
24
22
|
end
|
25
|
-
|
23
|
+
|
26
24
|
# Converts a boolean into an Authorize.Net boolean value string.
|
27
25
|
# This is designed to handle the wide range of boolean formats that
|
28
26
|
# Authorize.Net uses. If bool isn't a Boolean, its converted to a
|
@@ -35,32 +33,32 @@ module AuthorizeNet
|
|
35
33
|
bool.to_s
|
36
34
|
end
|
37
35
|
end
|
38
|
-
|
36
|
+
|
39
37
|
# Converts a value received from Authorize.Net into a BigDecimal.
|
40
38
|
def value_to_decimal(value)
|
41
39
|
value = 0 if value == '' # Ruby 2.4+ does not accept ""
|
42
|
-
BigDecimal
|
40
|
+
BigDecimal(value)
|
43
41
|
end
|
44
|
-
|
42
|
+
|
45
43
|
# Converts a BigDecimal (or Float) into an Authorize.Net float value
|
46
44
|
# string. If float isn't a BigDecimal (or Float), its converted to a
|
47
45
|
# string and passed along.
|
48
46
|
def decimal_to_value(float)
|
49
47
|
case float
|
50
48
|
when Float
|
51
|
-
"%0.2f"
|
49
|
+
format("%0.2f", float)
|
52
50
|
when BigDecimal
|
53
51
|
float.truncate(2).to_s('F')
|
54
52
|
else
|
55
53
|
float.to_s
|
56
54
|
end
|
57
55
|
end
|
58
|
-
|
56
|
+
|
59
57
|
# Converts a value received from Authorize.Net into a Date.
|
60
58
|
def value_to_date(value)
|
61
59
|
Date.strptime(value, '%Y-%m-%d')
|
62
60
|
end
|
63
|
-
|
61
|
+
|
64
62
|
# Converts a Date (or DateTime, or Time) into an Authorize.Net date
|
65
63
|
# value string. If date isn't a Date (or DateTime, or Time), its
|
66
64
|
# converted to a string and passed along.
|
@@ -72,12 +70,12 @@ module AuthorizeNet
|
|
72
70
|
date.to_s
|
73
71
|
end
|
74
72
|
end
|
75
|
-
|
73
|
+
|
76
74
|
# Converts a value received from Authorize.Net into a DateTime.
|
77
75
|
def value_to_datetime(value)
|
78
76
|
DateTime.strptime(value, '%Y-%m-%dT%H:%M:%S')
|
79
77
|
end
|
80
|
-
|
78
|
+
|
81
79
|
# Converts a Date (or DateTime, or Time) into an Authorize.Net datetime
|
82
80
|
# value string. If date isn't a Date (or DateTime, or Time), it's
|
83
81
|
# converted to a string and passed along.
|
@@ -91,36 +89,36 @@ module AuthorizeNet
|
|
91
89
|
datetime.to_s
|
92
90
|
end
|
93
91
|
end
|
94
|
-
|
92
|
+
|
95
93
|
# Converts a value received from Authorize.Net into an Integer.
|
96
94
|
def value_to_integer(value)
|
97
95
|
value.to_s.to_i
|
98
96
|
end
|
99
|
-
|
97
|
+
|
100
98
|
# Converts an Integer into an Authorize.Net integer string.
|
101
99
|
def integer_to_value(int)
|
102
100
|
int.to_s
|
103
101
|
end
|
104
|
-
|
102
|
+
|
105
103
|
# Converts a key value pair into a HTTP POST parameter. The key is
|
106
104
|
# prefixed with key_prefix when being converted to a parameter name.
|
107
105
|
def to_param(key, value, key_prefix = API_FIELD_PREFIX)
|
108
106
|
key_str = "#{key_prefix}#{key}="
|
109
|
-
if value.
|
107
|
+
if value.is_a?(Array)
|
110
108
|
(value.collect do |v|
|
111
|
-
key_str + CGI
|
109
|
+
key_str + CGI.escape(v.to_s)
|
112
110
|
end).join('&')
|
113
111
|
else
|
114
|
-
key_str + CGI
|
112
|
+
key_str + CGI.escape(value.to_s)
|
115
113
|
end
|
116
|
-
end
|
117
|
-
|
114
|
+
end
|
115
|
+
|
118
116
|
# Converts an internal field name (Symbol) into an external field
|
119
117
|
# name (Symbol) that can be consumed by the Authorize.Net API.
|
120
118
|
def to_external_field(key)
|
121
119
|
(API_FIELD_PREFIX + key.to_s).to_sym
|
122
120
|
end
|
123
|
-
|
121
|
+
|
124
122
|
# Converts an external field name (Symbol) into an internal field
|
125
123
|
# name (Symbol). This is the exact inverse of to_external_field.
|
126
124
|
# Running to_internal_field(to_external_field(:foo)) would return
|
@@ -133,15 +131,12 @@ module AuthorizeNet
|
|
133
131
|
|
134
132
|
# Provides some basic methods used by the various model classes.
|
135
133
|
module Model
|
136
|
-
|
137
134
|
# The constructor for models. Takes any of the supported attributes
|
138
135
|
# as key/value pairs.
|
139
136
|
def initialize(fields = {})
|
140
137
|
fields.each do |k, v|
|
141
138
|
method_name = (k.to_s + '=').to_sym
|
142
|
-
if
|
143
|
-
self.send(method_name, v)
|
144
|
-
end
|
139
|
+
send(method_name, v) if respond_to?(method_name)
|
145
140
|
end
|
146
141
|
end
|
147
142
|
|
@@ -155,7 +150,5 @@ module AuthorizeNet
|
|
155
150
|
def handle_multivalue_hashing(obj)
|
156
151
|
obj.to_a.collect(&:to_hash)
|
157
152
|
end
|
158
|
-
|
159
153
|
end
|
160
|
-
|
161
154
|
end
|