authorizenetsample 1.1.5 → 1.1.6

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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/CustomerProfiles/get-accept-customer-profile-page.rb +5 -23
  3. data/lib/CustomerProfiles/get-customer-profile.rb +3 -39
  4. data/lib/PaymentTransactions/create-an-accept-payment-transaction.rb +5 -45
  5. data/lib/PaymentTransactions/get-an-accept-payment-page.rb +49 -70
  6. data/lib/authorizenetsample.rb +12 -4
  7. metadata +6 -69
  8. data/lib/CustomerProfiles/create-customer-payment-profile.rb +0 -62
  9. data/lib/CustomerProfiles/create-customer-profile-from-transaction.rb +0 -51
  10. data/lib/CustomerProfiles/create-customer-profile.rb +0 -92
  11. data/lib/CustomerProfiles/create-customer-shipping-address.rb +0 -31
  12. data/lib/CustomerProfiles/delete-customer-payment-profile.rb +0 -32
  13. data/lib/CustomerProfiles/delete-customer-profile.rb +0 -31
  14. data/lib/CustomerProfiles/delete-customer-shipping-address.rb +0 -33
  15. data/lib/CustomerProfiles/get-customer-payment-profile-list.rb +0 -54
  16. data/lib/CustomerProfiles/get-customer-payment-profile.rb +0 -40
  17. data/lib/CustomerProfiles/get-customer-profile-ids.rb +0 -45
  18. data/lib/CustomerProfiles/get-customer-shipping-address.rb +0 -41
  19. data/lib/CustomerProfiles/update-customer-payment-profile.rb +0 -37
  20. data/lib/CustomerProfiles/update-customer-profile.rb +0 -37
  21. data/lib/CustomerProfiles/update-customer-shipping-address.rb +0 -37
  22. data/lib/CustomerProfiles/validate-customer-payment-profile.rb +0 -37
  23. data/lib/FraudManagement/approve-or-decline-held-transaction.rb +0 -57
  24. data/lib/FraudManagement/get-held-transaction-list.rb +0 -47
  25. data/lib/MobileInAppTransactions/create-an-accept-transaction.rb +0 -59
  26. data/lib/MobileInAppTransactions/create-an-android-pay-transaction.rb +0 -59
  27. data/lib/MobileInAppTransactions/create-an-apple-pay-transaction.rb +0 -58
  28. data/lib/PayPalExpressCheckout/authorization-and-capture-continued.rb +0 -69
  29. data/lib/PayPalExpressCheckout/authorization-and-capture.rb +0 -70
  30. data/lib/PayPalExpressCheckout/authorization-only-continued.rb +0 -70
  31. data/lib/PayPalExpressCheckout/authorization-only.rb +0 -71
  32. data/lib/PayPalExpressCheckout/credit.rb +0 -67
  33. data/lib/PayPalExpressCheckout/get-details.rb +0 -69
  34. data/lib/PayPalExpressCheckout/prior-authorization-capture.rb +0 -112
  35. data/lib/PayPalExpressCheckout/void.rb +0 -113
  36. data/lib/PaymentTransactions/authorize-credit-card.rb +0 -103
  37. data/lib/PaymentTransactions/capture-funds-authorized-through-another-channel.rb +0 -60
  38. data/lib/PaymentTransactions/capture-previously-authorized-amount.rb +0 -104
  39. data/lib/PaymentTransactions/charge-credit-card.rb +0 -104
  40. data/lib/PaymentTransactions/charge-customer-profile.rb +0 -61
  41. data/lib/PaymentTransactions/charge-tokenized-credit-card.rb +0 -60
  42. data/lib/PaymentTransactions/credit-bank-account.rb +0 -62
  43. data/lib/PaymentTransactions/debit-bank-account.rb +0 -64
  44. data/lib/PaymentTransactions/refund-transaction.rb +0 -60
  45. data/lib/PaymentTransactions/update-split-tender-group.rb +0 -44
  46. data/lib/PaymentTransactions/void-transaction.rb +0 -103
  47. data/lib/RecurringBilling/cancel-subscription.rb +0 -36
  48. data/lib/RecurringBilling/create-subscription-from-customer-profile.rb +0 -52
  49. data/lib/RecurringBilling/create-subscription.rb +0 -54
  50. data/lib/RecurringBilling/get-list-of-subscriptions.rb +0 -51
  51. data/lib/RecurringBilling/get-subscription-status.rb +0 -36
  52. data/lib/RecurringBilling/get-subscription.rb +0 -42
  53. data/lib/RecurringBilling/update-subscription.rb +0 -54
  54. data/lib/TransactionReporting/get-batch-statistics.rb +0 -57
  55. data/lib/TransactionReporting/get-customer-profile-transaction-list.rb +0 -49
  56. data/lib/TransactionReporting/get-merchant-details.rb +0 -50
  57. data/lib/TransactionReporting/get-settled-batch-list.rb +0 -49
  58. data/lib/TransactionReporting/get-transaction-details.rb +0 -40
  59. data/lib/TransactionReporting/get-transaction-list.rb +0 -58
  60. data/lib/TransactionReporting/get-unsettled-transaction-list.rb +0 -48
  61. data/lib/VisaCheckout/create-visa-checkout-transaction.rb +0 -62
  62. data/lib/VisaCheckout/decrypt-visa-checkout-data.rb +0 -37
  63. data/lib/authorize_netsample.rb +0 -21
  64. data/lib/credentials.yml +0 -9
  65. data/lib/spec/sample_code_spec.rb +0 -320
  66. data/lib/spec/spec.opts +0 -2
  67. data/lib/spec/spec_helper.rb +0 -10
  68. data/lib/spec/support/shared_helper.rb +0 -7
@@ -1,320 +0,0 @@
1
- cwd = Dir.pwd
2
-
3
- if cwd.include? "sample-code-ruby"
4
- puts "String includes sample-code-ruby"
5
- specpath = "./spec/"
6
- dirpath = "./"
7
- else
8
- specpath = "./sample-code-ruby/spec/"
9
- dirpath = "./sample-code-ruby/"
10
- end
11
-
12
- require specpath + "spec_helper"
13
-
14
- include AuthorizeNet::API
15
-
16
- describe "SampleCode Testing" do
17
-
18
- before :all do
19
- begin
20
- Dir.glob(dirpath + "**/*.rb") do |item| # note one extra "*"
21
- next if item == '.' or item == '..'
22
- item = item[0..-4]
23
-
24
- if item != specpath + 'sample_code_spec'
25
- puts "working on: #{item}"
26
- require item
27
- end
28
- end
29
- # Dir.glob("./sample-code-ruby/RecurringBilling/*") do |item| # note one extra "*"
30
- # next if item == '.' or item == '..'
31
- # item = item[0..-4]
32
- # puts "working on: #{item}"
33
- # require item
34
- # end
35
-
36
- creds = YAML.load_file(File.dirname(__FILE__) + "/credentials.yml")
37
- @api_key = creds['api_transaction_key']
38
- @api_login = creds['api_login_id']
39
- @gateway = :sandbox
40
- rescue Errno::ENOENT => e
41
- @api_key = "TEST"
42
- @api_login = "TEST"
43
- warn "WARNING: Running w/o valid AuthorizeNet sandbox credentials. Create spec/credentials.yml."
44
- end
45
- end
46
- def validate_response(response= nil)
47
- expect(response).not_to eq(nil)
48
- expect(response.messages).not_to eq(nil)
49
- expect(response.messages.resultCode).not_to eq(nil)
50
- expect(response.messages.resultCode).to eq(MessageTypeEnum::Ok)
51
- end
52
-
53
- it "should be able to run all Customer Profile sample code" do
54
- puts "START - Customer Profiles"
55
-
56
- response = create_customer_profile()
57
- validate_response(response)
58
- customerProfileId = response.customerProfileId
59
-
60
- response = create_customer_payment_profile(customerProfileId)
61
- validate_response(response)
62
- customerPaymentProfileId = response.customerPaymentProfileId
63
-
64
- response = create_customer_shipping_address(customerProfileId)
65
- validate_response(response)
66
- customerAddressId = response.customerAddressId
67
-
68
- #response = validate_customer_payment_profile(customerProfileId, customerPaymentProfileId)
69
- #validate_response(response)
70
-
71
- # create_transaction_for_profile = authorize_credit_card()
72
- # validate_response(response)
73
- # response = create_customer_profile_from_a_transaction(create_transaction_for_profile.transactionResponse.transId)
74
- # validate_response(response)
75
-
76
- response = get_customer_payment_profile(customerProfileId, customerPaymentProfileId)
77
- validate_response(response)
78
-
79
- response = get_customer_payment_profile_list()
80
- validate_response(response)
81
-
82
- response = get_customer_profile(customerProfileId)
83
- validate_response(response)
84
-
85
- response = get_customer_profile_ids()
86
- validate_response(response)
87
-
88
- response = get_customer_shipping_address(customerProfileId, customerAddressId)
89
- validate_response(response)
90
-
91
- response = get_accept_customer_profile_page(customerProfileId)
92
- validate_response(response)
93
-
94
- response = update_customer_payment_profile(customerProfileId, customerPaymentProfileId)
95
- validate_response(response)
96
-
97
- response = update_customer_profile(customerProfileId)
98
- validate_response(response)
99
-
100
- response = update_customer_shipping_address(customerProfileId, customerAddressId)
101
- validate_response(response)
102
-
103
- response = delete_customer_shipping_address(customerProfileId, customerAddressId)
104
- validate_response(response)
105
-
106
- response = delete_customer_payment_profile(customerProfileId, customerPaymentProfileId)
107
- validate_response(response)
108
-
109
- response = delete_customer_profile(customerProfileId)
110
- validate_response(response)
111
-
112
- end
113
-
114
- it "should be able to run all Recurring Billing sample code" do
115
- puts "START - Recurring Billing"
116
-
117
- response = create_Subscription()
118
- validate_response(response)
119
- subscriptionId = response.subscriptionId
120
-
121
- #Create subscription from customer profile
122
- profile_response = create_customer_profile()
123
- payment_response = create_customer_payment_profile(profile_response.customerProfileId)
124
- shipping_response = create_customer_shipping_address(profile_response.customerProfileId)
125
-
126
- #waiting for creating customer profile.
127
- puts "Waiting for creation of customer profile..."
128
- sleep 50
129
- puts "Proceeding"
130
-
131
- response = create_subscription_from_customer_profile(profile_response.customerProfileId, payment_response.customerPaymentProfileId, shipping_response.customerAddressId)
132
- validate_response(response)
133
-
134
- cancel_subscription(response.subscriptionId)
135
- delete_customer_profile(profile_response.customerProfileId)
136
-
137
- #End of create subscription from customer profile
138
-
139
- response = get_subscription(subscriptionId)
140
- validate_response(response)
141
-
142
- response = get_list_of_subscriptions()
143
- validate_response(response)
144
-
145
- response = get_subscription_status(subscriptionId)
146
- validate_response(response)
147
-
148
- response = update_subscription(subscriptionId)
149
- validate_response(response)
150
-
151
- response = cancel_subscription(subscriptionId)
152
- validate_response(response)
153
-
154
- end
155
-
156
-
157
- it "should be able to run all Payment Transaction sample code" do
158
- puts "START - Payment Transactions"
159
-
160
- response = authorize_credit_card()
161
- validate_response(response)
162
-
163
- response = capture_funds_authorized_through_another_channel()
164
- validate_response(response)
165
-
166
- # response = capture_only()
167
- # validate_response(response)
168
-
169
- response = capture_funds_authorized_through_another_channel()
170
- validate_response(response)
171
-
172
- response = capture_previously_authorized_amount()
173
- validate_response(response)
174
-
175
- response = charge_credit_card()
176
- validate_response(response)
177
-
178
- #create customer profile
179
- response = create_customer_profile()
180
- validate_response(response)
181
- customerProfileId = response.customerProfileId
182
-
183
- #create customer payment profile
184
- response = create_customer_payment_profile(customerProfileId)
185
- validate_response(response)
186
- customerPaymentProfileId = response.customerPaymentProfileId
187
-
188
- response = charge_customer_profile(customerProfileId, customerPaymentProfileId)
189
- validate_response(response)
190
-
191
- response = charge_tokenized_credit_card()
192
- validate_response(response)
193
-
194
- response = credit_bank_account()
195
- validate_response(response)
196
-
197
- response = debit_bank_account()
198
- validate_response(response)
199
-
200
- # response = refund_transaction()
201
- # validate_response(response)
202
-
203
- response = update_split_tender_group()
204
- validate_response(response)
205
-
206
- response = void_transaction()
207
- validate_response(response)
208
- end
209
-
210
-
211
- it "should be able to run all PayPal Express Checkout sample code" do
212
- puts "START - PayPal Express Checkout"
213
-
214
- puts "TEST - authorization and capture"
215
- response = authorization_and_capture()
216
- validate_response(response)
217
-
218
- # response = authorization_and_capture_continued()
219
- # validate_response(response)
220
-
221
- puts "TEST - authorization only"
222
- response = authorization_only()
223
- validate_response(response)
224
-
225
- authTransId = response.transactionResponse.transId
226
- puts "TransId to be used for AuthOnlyContinued, GetDetails & Void : #{authTransId}"
227
-
228
- puts "TEST - authorization only continued"
229
- response = authorization_only_continued(authTransId)
230
- validate_response(response)
231
-
232
- # response = credit()
233
- # validate_response(response)
234
-
235
- puts "TEST - Get Details"
236
- response = get_details(authTransId)
237
- validate_response(response)
238
-
239
- puts "TEST - prior authorization and capture"
240
- response = prior_authorization_capture()
241
- validate_response(response)
242
-
243
- # puts "TEST - Void"
244
- # authTransId = get_transId()
245
- # response = void(authTransId)
246
- # validate_response(response)
247
-
248
- end
249
-
250
- it "should be able to run all Transaction Reporting sample code" do
251
- puts "START - Transaction Reporting"
252
-
253
- response = get_settled_batch_List()
254
- validate_response(response)
255
-
256
- #Start Get Batch Statistics
257
- batchId = response.batchList.batch[0].batchId
258
-
259
- response = get_batch_Statistics(batchId)
260
- validate_response(response)
261
- #End Get Batch Statistics
262
-
263
- response = get_transaction_Details()
264
- validate_response(response)
265
-
266
- response = get_transaction_List()
267
- validate_response(response)
268
-
269
- response = get_unsettled_transaction_List()
270
- validate_response(response)
271
-
272
- response = get_Transaction_List_For_Customer()
273
- validate_response(response)
274
-
275
- end
276
-
277
-
278
- it "should be able to run Merchant Details sample code" do
279
- puts "START - Transaction Reporting / Merchant Details"
280
-
281
- response = get_merchant_details()
282
- validate_response(response)
283
-
284
- end
285
-
286
-
287
- it "should be able to run all Visa Checkout sample code" do
288
- puts "START - Visa Checkout"
289
-
290
- # response = create_visa_checkout_transaction()
291
- # validate_response(response)
292
-
293
- response = decrypt_visa_checkout_data()
294
- validate_response(response)
295
-
296
- end
297
-
298
- it "should be able to run all Apple Pay sample code" do
299
-
300
- # response = create_an_apple_pay_transaction()
301
- # validate_response(response)
302
- #
303
- end
304
-
305
- it "should be able to run Update Held Transaction sample code" do
306
-
307
- #response = update_held_transaction("12345")
308
- #validate_response(response)
309
-
310
- end
311
-
312
- it "should be able to run Get Accept Payment Page sample code" do
313
-
314
- response = get_an_accept_payment_page()
315
- validate_response(response)
316
-
317
- end
318
-
319
-
320
- end
data/lib/spec/spec.opts DELETED
@@ -1,2 +0,0 @@
1
- --colour
2
- --format progress
@@ -1,10 +0,0 @@
1
- #require 'coveralls'
2
- #Coveralls.wear!
3
- require "authorizenet"
4
- require "yaml"
5
-
6
- Dir['./spec/support/**/*.rb'].each{ |f| require f }
7
-
8
- RSpec.configure do |config|
9
- config.include SharedHelper
10
- end
@@ -1,7 +0,0 @@
1
- module SharedHelper
2
- def credentials
3
- $credentials ||= YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
4
- rescue Errno::ENOENT
5
- warn "WARNING: Running w/o valid AuthorizeNet sandbox credentials. Create spec/credentials.yml."
6
- end
7
- end