vaulted_billing 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/LICENSE +19 -0
  2. data/lib/vaulted_billing/gateways/bogus.rb +2 -0
  3. data/lib/vaulted_billing/version.rb +1 -1
  4. data/spec/certification/ipcommerce/README.md +9 -0
  5. data/spec/certification/ipcommerce/TODO.md +1 -0
  6. data/spec/certification/ipcommerce/host_capture_ecommerce.rb +318 -0
  7. data/spec/certification/ipcommerce/ipcommerce_transaction.rb +28 -0
  8. data/spec/certification/ipcommerce/terminal_capture_ecommerce.rb +298 -0
  9. data/spec/config.example.yml +18 -0
  10. data/spec/factories/credit_cards.rb +38 -0
  11. data/spec/factories/customers.rb +7 -0
  12. data/spec/factories/sequences.rb +22 -0
  13. data/spec/fixtures/net/authorize_net_cim/add_customer/failure.yml +38 -0
  14. data/spec/fixtures/net/authorize_net_cim/add_customer/success.yml +39 -0
  15. data/spec/fixtures/net/authorize_net_cim/add_customer_credit_card/failure.yml +83 -0
  16. data/spec/fixtures/net/authorize_net_cim/add_customer_credit_card/success.yml +81 -0
  17. data/spec/fixtures/net/authorize_net_cim/authorize/failure.yml +121 -0
  18. data/spec/fixtures/net/authorize_net_cim/authorize/success.yml +121 -0
  19. data/spec/fixtures/net/authorize_net_cim/capture/failure.yml +161 -0
  20. data/spec/fixtures/net/authorize_net_cim/capture/success.yml +160 -0
  21. data/spec/fixtures/net/authorize_net_cim/purchase/failure.yml +122 -0
  22. data/spec/fixtures/net/authorize_net_cim/purchase/success.yml +122 -0
  23. data/spec/fixtures/net/authorize_net_cim/refund/failure.yml +123 -0
  24. data/spec/fixtures/net/authorize_net_cim/refund/failure_2.yml +43 -0
  25. data/spec/fixtures/net/authorize_net_cim/remove_customer/failure.yml +76 -0
  26. data/spec/fixtures/net/authorize_net_cim/remove_customer/success.yml +75 -0
  27. data/spec/fixtures/net/authorize_net_cim/remove_customer_credit_card/failure.yml +156 -0
  28. data/spec/fixtures/net/authorize_net_cim/remove_customer_credit_card/success.yml +118 -0
  29. data/spec/fixtures/net/authorize_net_cim/update_customer/failure.yml +77 -0
  30. data/spec/fixtures/net/authorize_net_cim/update_customer/success.yml +76 -0
  31. data/spec/fixtures/net/authorize_net_cim/update_customer_credit_card/failure.yml +125 -0
  32. data/spec/fixtures/net/authorize_net_cim/update_customer_credit_card/success.yml +124 -0
  33. data/spec/fixtures/net/authorize_net_cim/void/success.yml +159 -0
  34. data/spec/fixtures/net/ipcommerce/add_customer_credit_card/failure.yml +53 -0
  35. data/spec/fixtures/net/ipcommerce/add_customer_credit_card/success.yml +103 -0
  36. data/spec/fixtures/net/ipcommerce/authorize/existing/failure.yml +51 -0
  37. data/spec/fixtures/net/ipcommerce/authorize/existing/success.yml +105 -0
  38. data/spec/fixtures/net/ipcommerce/authorize/new/avs/bad_format.yml +53 -0
  39. data/spec/fixtures/net/ipcommerce/authorize/new/avs/issuer_not_certified.yml +53 -0
  40. data/spec/fixtures/net/ipcommerce/authorize/new/avs/match.yml +53 -0
  41. data/spec/fixtures/net/ipcommerce/authorize/new/avs/no_match.yml +53 -0
  42. data/spec/fixtures/net/ipcommerce/authorize/new/avs/no_response_from_card_association.yml +53 -0
  43. data/spec/fixtures/net/ipcommerce/authorize/new/avs/not_included.yml +53 -0
  44. data/spec/fixtures/net/ipcommerce/authorize/new/avs/not_sent.yml +53 -0
  45. data/spec/fixtures/net/ipcommerce/authorize/new/avs/not_verified.yml +53 -0
  46. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/invalid.yml +53 -0
  47. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/issuer_not_certified.yml +53 -0
  48. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/no_code_present.yml +53 -0
  49. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/no_match.yml +53 -0
  50. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/no_response.yml +53 -0
  51. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/not_applicable.yml +53 -0
  52. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/not_processed.yml +53 -0
  53. data/spec/fixtures/net/ipcommerce/authorize/new/cvv/should_have_been_present.yml +53 -0
  54. data/spec/fixtures/net/ipcommerce/authorize/new/failure.yml +53 -0
  55. data/spec/fixtures/net/ipcommerce/authorize/new/success.yml +53 -0
  56. data/spec/fixtures/net/ipcommerce/capture/failure.yml +78 -0
  57. data/spec/fixtures/net/ipcommerce/capture/invalid.yml +78 -0
  58. data/spec/fixtures/net/ipcommerce/capture/success.yml +78 -0
  59. data/spec/fixtures/net/ipcommerce/failover.yml +53 -0
  60. data/spec/fixtures/net/ipcommerce/purchase/existing/failure.yml +51 -0
  61. data/spec/fixtures/net/ipcommerce/purchase/existing/success.yml +105 -0
  62. data/spec/fixtures/net/ipcommerce/purchase/new/failure.yml +53 -0
  63. data/spec/fixtures/net/ipcommerce/purchase/new/success.yml +53 -0
  64. data/spec/fixtures/net/ipcommerce/refund/failure.yml +78 -0
  65. data/spec/fixtures/net/ipcommerce/refund/success.yml +80 -0
  66. data/spec/fixtures/net/ipcommerce/update_customer_credit_card/failure.yml +53 -0
  67. data/spec/fixtures/net/ipcommerce/update_customer_credit_card/success.yml +103 -0
  68. data/spec/fixtures/net/ipcommerce/void/failure.yml +78 -0
  69. data/spec/fixtures/net/ipcommerce/void/success.yml +78 -0
  70. data/spec/fixtures/net/nmi_customer_vault/add_customer_credit_card/failure.yml +26 -0
  71. data/spec/fixtures/net/nmi_customer_vault/add_customer_credit_card/success.yml +26 -0
  72. data/spec/fixtures/net/nmi_customer_vault/authorize/decline.yml +51 -0
  73. data/spec/fixtures/net/nmi_customer_vault/authorize/success.yml +51 -0
  74. data/spec/fixtures/net/nmi_customer_vault/capture/failure.yml +76 -0
  75. data/spec/fixtures/net/nmi_customer_vault/capture/success.yml +76 -0
  76. data/spec/fixtures/net/nmi_customer_vault/purchase/decline.yml +51 -0
  77. data/spec/fixtures/net/nmi_customer_vault/purchase/success.yml +51 -0
  78. data/spec/fixtures/net/nmi_customer_vault/refund/failure.yml +101 -0
  79. data/spec/fixtures/net/nmi_customer_vault/remove_customer_credit_card/failure.yml +26 -0
  80. data/spec/fixtures/net/nmi_customer_vault/remove_customer_credit_card/success.yml +51 -0
  81. data/spec/fixtures/net/nmi_customer_vault/update_customer_credit_card/success.yml +51 -0
  82. data/spec/fixtures/net/nmi_customer_vault/void/failure.yml +26 -0
  83. data/spec/fixtures/net/nmi_customer_vault/void/success.yml +76 -0
  84. data/spec/models/vaulted_billing/configuration_spec.rb +62 -0
  85. data/spec/models/vaulted_billing/core_ext/hash_spec.rb +47 -0
  86. data/spec/models/vaulted_billing/credit_card_spec.rb +61 -0
  87. data/spec/models/vaulted_billing/gateway_spec.rb +115 -0
  88. data/spec/models/vaulted_billing/http_spec.rb +154 -0
  89. data/spec/models/vaulted_billing/transaction_spec.rb +60 -0
  90. data/spec/models/vaulted_billing_spec.rb +16 -0
  91. data/spec/requests/authorize_net_cim_spec.rb +506 -0
  92. data/spec/requests/bogus_spec.rb +144 -0
  93. data/spec/requests/ipcommerce_spec.rb +518 -0
  94. data/spec/requests/nmi_customer_vault_spec.rb +390 -0
  95. data/spec/spec_helper.rb +12 -0
  96. data/spec/support/_vaulted_billing.rb +8 -0
  97. data/spec/support/factory_girl.rb +5 -0
  98. data/spec/support/faker.rb +1 -0
  99. data/spec/support/helpers.rb +46 -0
  100. data/spec/support/logging.rb +2 -0
  101. data/spec/support/test_exception.rb +1 -0
  102. data/spec/support/vcr.rb +49 -0
  103. data/spec/support/webmock.rb +7 -0
  104. metadata +312 -37
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Envy Labs, LLC.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -105,6 +105,8 @@ module VaultedBilling
105
105
  end
106
106
 
107
107
  def transaction_response(credit_card, amount)
108
+ credit_card = credit_card.to_vaulted_billing if credit_card
109
+
108
110
  attributes = { :id => new_identifier }
109
111
  attributes[:masked_card_number] = "XXXX%04d" % [credit_card ? credit_card.card_number.to_s[-4..-1].to_i : rand(9999)]
110
112
  success = true
@@ -1,3 +1,3 @@
1
1
  module VaultedBilling
2
- Version = '1.3.0'
2
+ Version = '1.3.1'
3
3
  end
@@ -0,0 +1,9 @@
1
+ # Certification
2
+
3
+ In order to run certification scripts, you'll need to also:
4
+
5
+ Add the following to your Gemfile:
6
+
7
+ gem 'vaulted_billing-termcap'
8
+
9
+ Create your own merchant profiles based on the application id and service ids provided to you by IP Commerce.
@@ -0,0 +1 @@
1
+ * Add support for host capture 'Secure Card Data Tokenization Tests'.
@@ -0,0 +1,318 @@
1
+ require 'spec_helper'
2
+ require_relative 'ipcommerce_transaction.rb'
3
+
4
+ describe VaultedBilling::Gateways::Ipcommerce do
5
+ let(:gateway) { VaultedBilling.gateway(:ipcommerce).new }
6
+ let(:options) { { :merchant_profile_id => 'TicketTest_E4FB800001', :workflow_id => 'E4FB800001' } } # Host Capture: FDC
7
+
8
+ before(:all) do
9
+ puts "test code, status code, approval code, status message, transaction id"
10
+ end
11
+
12
+ context "AuthorizeAndCapture" do
13
+ let(:purchase) { gateway.purchase(nil, credit_card, amount, options) }
14
+
15
+ subject { IpcommerceTransaction.new(code, purchase) }
16
+
17
+ context 'setup' do
18
+ use_vcr_cassette 'ipcommerce/certification/host/a-setup'
19
+ it "clears captures" do
20
+ gateway.capture_all(options)
21
+ end
22
+ end
23
+
24
+ context 'F_A1' do
25
+ let(:code) { "F_A1" }
26
+ let(:amount) { 12.00 }
27
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :postal_code => '10101') }
28
+ use_vcr_cassette 'ipcommerce/certification/host/f_a1'
29
+
30
+ it "outputs the result" do
31
+ puts subject.print
32
+ end
33
+ end
34
+
35
+ context 'F_A2' do
36
+ let(:code) { "F_A2" }
37
+ let(:amount) { 12.00 }
38
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '6011000995504101', :postal_code => '10101') }
39
+ use_vcr_cassette 'ipcommerce/certification/host/f_a2'
40
+
41
+ it "outputs the result" do
42
+ puts subject.print
43
+ end
44
+ end
45
+
46
+ context 'F_A3' do
47
+ let(:code) { "F_A3" }
48
+ let(:amount) { 25.00 }
49
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '371449635398456', :cvv_number => '1111', :postal_code => '10101') }
50
+ use_vcr_cassette 'ipcommerce/certification/host/f_a3'
51
+
52
+ it "outputs the result" do
53
+ puts subject.print
54
+ end
55
+ end
56
+
57
+ context 'F_A4' do
58
+ let(:code) { "F_A4" }
59
+ let(:amount) { 26.00 }
60
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :cvv_number => '111', :postal_code => '10101') }
61
+ use_vcr_cassette 'ipcommerce/certification/host/f_a4'
62
+
63
+ it "outputs the result" do
64
+ puts subject.print
65
+ end
66
+ end
67
+
68
+ context 'F_A5' do
69
+ let(:code) { "F_A5" }
70
+ let(:amount) { 12.00 }
71
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '371449635398456', :postal_code => '10101') }
72
+ use_vcr_cassette 'ipcommerce/certification/host/f_a5'
73
+
74
+ it "outputs the result" do
75
+ puts subject.print
76
+ end
77
+ end
78
+
79
+ context 'F_A6' do
80
+ let(:code) { "F_A6" }
81
+ let(:amount) { 10.83 }
82
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :cvv_number => '777', :postal_code => '10101') }
83
+ use_vcr_cassette 'ipcommerce/certification/host/f_a6'
84
+
85
+ it "outputs the result" do
86
+ puts subject.print
87
+ end
88
+ end
89
+ end
90
+
91
+
92
+ context 'ReturnById' do
93
+ let(:purchase) { gateway.purchase(nil, credit_card, purchase_amount, options) }
94
+ let(:refund) { gateway.refund(purchase.id, refund_amount, options) }
95
+
96
+ context 'F_B1 - F_B2' do
97
+ let(:purchase_amount) { 29.00 }
98
+ let(:refund_amount) { 12.00 }
99
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :cvv_number => '111', :postal_code => '10101') }
100
+ use_vcr_cassette 'ipcommerce/certification/host/f_b1-b2'
101
+
102
+ it "ouputs the result" do
103
+ puts IpcommerceTransaction.new('F_B1', purchase).print
104
+ puts IpcommerceTransaction.new('F_B2', refund).print
105
+ end
106
+ end
107
+
108
+ context 'F_B3 - F_B4' do
109
+ let(:purchase_amount) { 7.00 }
110
+ let(:refund_amount) { purchase_amount }
111
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :cvv_number => '111', :postal_code => '10101') }
112
+ use_vcr_cassette 'ipcommerce/certification/host/f_b3-b4'
113
+
114
+ it "ouputs the result" do
115
+ puts IpcommerceTransaction.new('F_B3', purchase).print
116
+ puts IpcommerceTransaction.new('F_B4', refund).print
117
+ end
118
+ end
119
+ end
120
+
121
+ context 'Undo (Void)' do
122
+ let(:authorization) { gateway.authorize(nil, credit_card, amount, options) }
123
+ let(:void) { gateway.void(authorization.id, options) }
124
+
125
+ context 'F_C1 - F_C2' do
126
+ let(:amount) { 57.00 }
127
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :cvv_number => '111', :postal_code => '10101') }
128
+ use_vcr_cassette 'ipcommerce/certification/host/f_c1-c2'
129
+
130
+ it "ouputs the result" do
131
+ puts IpcommerceTransaction.new("F_C1", authorization).print
132
+ puts IpcommerceTransaction.new("F_C2", void).print
133
+ end
134
+ end
135
+
136
+ context 'F_C3 - F_C4' do
137
+ let(:amount) { 55.00 }
138
+ let(:authorization) { gateway.authorize(nil, credit_card, amount, options) }
139
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :postal_code => '10101') }
140
+ use_vcr_cassette 'ipcommerce/certification/host/f_c3-c4'
141
+
142
+ it "ouputs the result" do
143
+ puts IpcommerceTransaction.new("F_C3", authorization).print
144
+ puts IpcommerceTransaction.new("F_C4", void).print
145
+ end
146
+ end
147
+ end
148
+
149
+
150
+ context 'Non-Standard Card Tests (Purchase)' do
151
+ let(:purchase) { gateway.purchase(nil, credit_card, amount, options) }
152
+
153
+ context 'F_D1' do
154
+ let(:amount) { 17.00 }
155
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '6011000995504101', :cvv_number => '111', :postal_code => '10101') }
156
+ use_vcr_cassette 'ipcommerce/certification/host/f_d1'
157
+
158
+ it "ouputs the result" do
159
+ puts IpcommerceTransaction.new("F_D1", purchase).print
160
+ end
161
+ end
162
+
163
+ context 'F_D2' do
164
+ let(:amount) { 33.03 }
165
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :postal_code => '10101') }
166
+ use_vcr_cassette 'ipcommerce/certification/host/f_d2'
167
+
168
+ it "ouputs the result" do
169
+ puts IpcommerceTransaction.new("F_D2", purchase).print
170
+ end
171
+ end
172
+
173
+ context 'F_D3' do
174
+ let(:amount) { 34.02 }
175
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :postal_code => '10101') }
176
+ use_vcr_cassette 'ipcommerce/certification/host/f_d3'
177
+
178
+ it "ouputs the result" do
179
+ puts IpcommerceTransaction.new("F_D3", purchase).print
180
+ end
181
+ end
182
+
183
+ context 'F_D4' do
184
+ let(:amount) { 35.05 }
185
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :postal_code => '10101') }
186
+ use_vcr_cassette 'ipcommerce/certification/host/f_d4'
187
+
188
+ it "ouputs the result" do
189
+ puts IpcommerceTransaction.new("F_D4", purchase).print
190
+ end
191
+ end
192
+ end
193
+
194
+ context 'Voice Authorization Tests' do
195
+ let(:purchase) { gateway.purchase(nil, credit_card, amount, options.merge(:approval_code => '555123')) }
196
+ let(:amount) { 8.00 }
197
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :cvv_number => '111') }
198
+ use_vcr_cassette 'ipcommerce/certification/host/f_v1'
199
+
200
+ it "F_V1" do
201
+ puts IpcommerceTransaction.new("F_V1", purchase).print
202
+ end
203
+ end
204
+
205
+ context 'Pre-authorization Tests' do
206
+ let(:authorization) { gateway.authorize(nil, credit_card, amount, options) }
207
+ let(:purchase) { gateway.purchase(nil, credit_card, amount, options) }
208
+ let(:capture) { gateway.capture(authorization.id, amount, options) }
209
+
210
+ context 'F_F1 - F_F2' do
211
+ let(:amount) { 18.00 }
212
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '371449635398456', :postal_code => '10101') }
213
+ use_vcr_cassette 'ipcommerce/certification/host/f_f1-f2'
214
+
215
+ it "ouputs the result" do
216
+ puts IpcommerceTransaction.new("F_F1", authorization).print
217
+ puts IpcommerceTransaction.new("F_F2", capture).print
218
+ end
219
+ end
220
+
221
+ context 'F_F3 - F_F4' do
222
+ let(:amount) { 13.00 }
223
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :postal_code => '10101') }
224
+ use_vcr_cassette 'ipcommerce/certification/host/f_f3-f4'
225
+
226
+ it "ouputs the result" do
227
+ puts IpcommerceTransaction.new("F_F3", authorization).print
228
+ puts IpcommerceTransaction.new("F_F4", capture).print
229
+ end
230
+ end
231
+
232
+ context 'F_F5' do
233
+ let(:amount) { 19.00 }
234
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :postal_code => '10101') }
235
+ use_vcr_cassette 'ipcommerce/certification/host/f_f5'
236
+
237
+ it "ouputs the result" do
238
+ puts IpcommerceTransaction.new("F_F5", purchase).print
239
+ end
240
+ end
241
+
242
+ context 'F_F6' do
243
+ let(:amount) { 87.00 }
244
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :cvv_number => '111', :postal_code => '10101') }
245
+ use_vcr_cassette 'ipcommerce/certification/host/f_f6'
246
+
247
+ it "ouputs the result" do
248
+ puts IpcommerceTransaction.new("F_F6", purchase).print
249
+ end
250
+ end
251
+ end
252
+
253
+ context 'Secure Card Data Tokenization Tests' do
254
+ let(:i1_authorization) { gateway.authorize(nil, i1_credit_card, 17.00, options) }
255
+ let(:i1_credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :street_address => '1000 1st Av', :postal_code => '10101') }
256
+ let(:i2_authorization) { gateway.authorize(nil, i2_credit_card, 18.00, options) }
257
+ let(:i2_credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :cvv_number => '111', :postal_code => '10101') }
258
+ let(:i3_authorization) { gateway.authorize(nil, i3_credit_card, 19.00, options) }
259
+ let(:i3_credit_card) { Factory.build(:expires_credit_card, :card_number => '371449635398456', :cvv_number => '1111', :postal_code => '10101') }
260
+ let(:i4_purchase) { gateway.purchase(nil, i1_credit_card, 16.00, options.merge(:transaction_id => i1_authorization.id)) }
261
+ let(:i5_purchase) { gateway.purchase(nil, i2_credit_card, 18.00, options.merge(:transaction_id => i2_authorization.id)) }
262
+ let(:i6_purchase) { gateway.purchase(nil, i3_credit_card, 31.83, options.merge(:transaction_id => i3_authorization.id)) }
263
+
264
+ use_vcr_cassette 'ipcommerce/certification/host/f_i1-i6'
265
+ it "outputs the results" do
266
+ puts IpcommerceTransaction.new("F_I1", i1_authorization).print
267
+ puts IpcommerceTransaction.new("F_I2", i2_authorization).print
268
+ puts IpcommerceTransaction.new("F_I3", i3_authorization).print
269
+ puts IpcommerceTransaction.new("F_I4", i4_purchase).print
270
+ puts IpcommerceTransaction.new("F_I5", i5_purchase).print
271
+ puts IpcommerceTransaction.new("F_I6", i6_purchase).print
272
+ end
273
+ end
274
+
275
+ context 'Transaction Management Services (TMS)', :focus => true do
276
+ let(:batch) { "fdc" }
277
+ let(:t1_purchase) { gateway.purchase(nil, t1_credit_card, 30.00, options) }
278
+ let(:t1_credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :postal_code => '10101', :cvv_number => '111') }
279
+ let(:t2_refund) { gateway.refund(t1_purchase.id, 30.00, options) }
280
+
281
+ let(:t3_authorization) { gateway.authorize(nil, t3_credit_card, 32.00, options) }
282
+ let(:t3_credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :postal_code => '10101', :cvv_number => '111') }
283
+ let(:t4_void) { gateway.void(t3_authorization.id, options) }
284
+
285
+ let(:t5_authorization) { gateway.authorize(nil, t5_credit_card, 33.00, options) }
286
+ let(:t5_credit_card) { Factory.build(:expires_credit_card, :card_number => '6011000995504101', :postal_code => '10101', :cvv_number => '111') }
287
+
288
+ let(:t6_purchase) { gateway.purchase(nil, t6_credit_card, 34.00, options) }
289
+ let(:t6_credit_card) { Factory.build(:expires_credit_card, :card_number => '371449635398456', :postal_code => '10101', :cvv_number => '111') }
290
+
291
+ let(:t7_authorization) { gateway.authorize(nil, t7_credit_card, 34.00, options) }
292
+ let(:t7_credit_card) { Factory.build(:expires_credit_card, :card_number => '371449635398456', :postal_code => '10101', :cvv_number => '111') }
293
+
294
+ use_vcr_cassette 'ipcommerce/certification/host/t', :record => :new_episodes
295
+
296
+ context 'setup' do
297
+ use_vcr_cassette 'ipcommerce/certification/host/t-setup', :record => :new_episodes
298
+ it "clears captures" do
299
+ gateway.capture_all(options)
300
+ end
301
+ end
302
+
303
+ it "outputs the result" do
304
+ puts IpcommerceTransaction.new("#{batch}_T1", t1_purchase).print
305
+ puts IpcommerceTransaction.new("#{batch}_T2", t2_refund).print
306
+ puts IpcommerceTransaction.new("#{batch}_T3", t3_authorization).print
307
+ puts IpcommerceTransaction.new("#{batch}_T4", t4_void).print
308
+ puts IpcommerceTransaction.new("#{batch}_T5", t5_authorization).print
309
+ puts IpcommerceTransaction.new("#{batch}_T6", t6_purchase).print
310
+ puts IpcommerceTransaction.new("#{batch}_T7", t7_authorization).print
311
+
312
+ gateway.query_batch
313
+ gateway.query_transactions_summary
314
+ gateway.query_transactions_families({ :transaction_ids => [t5_authorization.id]})
315
+ gateway.query_transaction_details({ :transaction_ids => [t1_purchase.id]})
316
+ end
317
+ end
318
+ end
@@ -0,0 +1,28 @@
1
+ class IpcommerceTransaction
2
+ def print
3
+
4
+ "'%s', '%s', '%s', '%s', '%s'" % [
5
+ @code,
6
+ parsed_response["StatusCode"],
7
+ parsed_response["ApprovalCode"],
8
+ parsed_response["StatusMessage"],
9
+ parsed_response["TransactionId"]
10
+ ]
11
+ end
12
+
13
+ attr_accessor
14
+
15
+ def initialize(code, transaction)
16
+ @code = code
17
+ @transaction = transaction
18
+ end
19
+
20
+ def parsed_response
21
+ @response ||= begin
22
+ response = MultiJson.decode(@transaction.raw_response)
23
+ response.is_a?(Array) ? response.first : response
24
+ rescue
25
+ "Error response"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,298 @@
1
+ require 'spec_helper'
2
+ require_relative 'ipcommerce_transaction.rb'
3
+
4
+ describe VaultedBilling::Gateways::Ipcommerce do
5
+ let(:gateway) { VaultedBilling.gateway(:ipcommerce).new }
6
+ # let(:options) { { :merchant_profile_id => 'TicketTest_C82ED00001', :workflow_id => 'C82ED00001' }} # Terminal Capture: Tsys
7
+ # let(:batch) { "T" }
8
+
9
+ let(:options) { { :merchant_profile_id => 'TicketTest_B447F00001', :workflow_id => 'B447F00001' }} # Terminal Capture: Vantiv / 5th 3rd Bank
10
+ let(:batch) { "V" }
11
+
12
+
13
+ before(:all) do
14
+ puts "test code, status code, approval code, status message, transaction id"
15
+ end
16
+
17
+ context "Authorization Tests" do
18
+ let(:customer) { Factory.build(:customer) }
19
+ let(:authorization) { gateway.authorize(nil, credit_card, amount, options) }
20
+
21
+ subject { IpcommerceTransaction.new(code, authorization) }
22
+
23
+ context 'setup' do
24
+ use_vcr_cassette 'ipcommerce/certification/terminal/a-setup'
25
+ it "clears captures" do
26
+ gateway.capture_all(options)
27
+ end
28
+ end
29
+
30
+ context 'A1' do
31
+ let(:code) { "#{batch}_A1" }
32
+ let(:amount) { 2.00 }
33
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :cvv_number => '111', :postal_code => '10101') }
34
+ use_vcr_cassette 'ipcommerce/certification/terminal/a1'
35
+
36
+
37
+ it "outputs the result" do
38
+ puts subject.print
39
+ end
40
+ end
41
+
42
+ context 'A2' do
43
+ let(:code) { "#{batch}_A2" }
44
+ let(:amount) { 2.50 }
45
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :cvv_number => '111', :postal_code => '10101') }
46
+ use_vcr_cassette 'ipcommerce/certification/terminal/a2'
47
+
48
+ it "outputs the result" do
49
+ puts subject.print
50
+ end
51
+ end
52
+
53
+ context 'A3' do
54
+ let(:code) { "#{batch}_A3" }
55
+ let(:amount) { 5.00 }
56
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '371449635398456', :cvv_number => '1111', :postal_code => '10101') }
57
+ use_vcr_cassette 'ipcommerce/certification/terminal/a3'
58
+
59
+ it "outputs the result" do
60
+ puts subject.print
61
+ end
62
+ end
63
+
64
+ context 'A4' do
65
+ let(:code) { "#{batch}_A4" }
66
+ let(:amount) { 6.00 }
67
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :cvv_number => '111', :postal_code => '10101') }
68
+ use_vcr_cassette 'ipcommerce/certification/terminal/a4'
69
+
70
+ it "outputs the result" do
71
+ puts subject.print
72
+ end
73
+ end
74
+
75
+ context 'A5' do
76
+ let(:code) { "#{batch}_A5" }
77
+ let(:amount) { 2.15 }
78
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :cvv_number => nil, :postal_code => '10101') }
79
+ use_vcr_cassette 'ipcommerce/certification/terminal/a5'
80
+
81
+ it "outputs the result" do
82
+ puts subject.print
83
+ end
84
+ end
85
+
86
+ context 'A6' do
87
+ let(:code) { "#{batch}_A6" }
88
+ let(:amount) { 10.83 }
89
+ let(:credit_card) { Factory.build(:expires_credit_card, :card_number => '371449635398456', :cvv_number => 777, :postal_code => '10101') }
90
+ use_vcr_cassette 'ipcommerce/certification/terminal/a6'
91
+
92
+ it "outputs the result" do
93
+ puts subject.print
94
+ end
95
+ end
96
+
97
+ context 'A7' do
98
+ let(:capture_all) { gateway.capture_all(options) }
99
+ use_vcr_cassette 'ipcommerce/certification/terminal/a7'
100
+
101
+ it "outputs the results" do
102
+ puts IpcommerceTransaction.new("#{batch}_A7", capture_all).print
103
+ end
104
+ end
105
+ end
106
+
107
+ context "ReturnById Tests" do
108
+ let(:b1_authorization) { gateway.authorize(nil, b1_credit_card, 49.00, options) }
109
+ let(:b1_credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :cvv_number => '111', :postal_code => '10101') }
110
+ let(:b2_capture_selective) { gateway.capture_selective([b1_authorization.id], nil, options) }
111
+ let(:b3_refund) { gateway.refund(b1_authorization.id, 32.00, options) }
112
+ let(:b4_authorization) { gateway.authorize(nil, b4_credit_card, 27.00, options) }
113
+ let(:b4_credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :cvv_number => '111', :postal_code => '10101') }
114
+ let(:b6_refund) { gateway.refund(b4_authorization.id, 27.00, options) }
115
+ let(:b7_return_unlinked) { gateway.return_unlinked(nil, unlinked_credit_card, 3.00, options) }
116
+ let(:unlinked_credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454') }
117
+
118
+ use_vcr_cassette 'ipcommerce/certification/terminal/b'
119
+
120
+ context 'setup' do
121
+ use_vcr_cassette 'ipcommerce/certification/terminal/b-setup'
122
+ it "clears captures" do
123
+ gateway.capture_all(options)
124
+ end
125
+ end
126
+
127
+ it "outputs the result" do
128
+ puts IpcommerceTransaction.new("#{batch}_B1", b1_authorization).print
129
+ puts IpcommerceTransaction.new("#{batch}_B2", b2_capture_selective).print
130
+ puts IpcommerceTransaction.new("#{batch}_B3", b3_refund).print
131
+ puts IpcommerceTransaction.new("#{batch}_B4", b4_authorization).print
132
+ puts IpcommerceTransaction.new("#{batch}_B5", gateway.capture_all(options)).print
133
+ puts IpcommerceTransaction.new("#{batch}_B6", b6_refund).print
134
+ puts IpcommerceTransaction.new("#{batch}_B7", b7_return_unlinked).print
135
+ puts IpcommerceTransaction.new("#{batch}_B8", gateway.capture_all(options)).print
136
+ end
137
+ end
138
+
139
+ context "Undo (Void) Tests" do
140
+ let(:c1_authorization) { gateway.authorize(nil, c1_credit_card, 57.00, options) }
141
+ let(:c1_credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :cvv_number => '111', :postal_code => '10101') }
142
+ let(:c2_void) { gateway.void(c1_authorization.id, options) }
143
+ let(:c3_authorization) { gateway.authorize(nil, c3_credit_card, 54.00, options) }
144
+ let(:c3_credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :cvv_number => '111', :postal_code => '10101') }
145
+ let(:c4_capture_selective) { gateway.capture_selective([c3_authorization.id], nil, options) }
146
+ let(:c5_authorization) { gateway.authorize(nil, c5_credit_card, 61.00, options) }
147
+ let(:c5_credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :cvv_number => '111', :postal_code => '10101') }
148
+ let(:c6_void) { gateway.void(c5_authorization.id, options) }
149
+ let(:c7_authorization) { gateway.authorize(nil, c3_credit_card, 63.00, options) }
150
+ let(:c7_credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :cvv_number => '111', :postal_code => '10101') }
151
+
152
+ use_vcr_cassette 'ipcommerce/certification/terminal/c'
153
+
154
+ context 'setup' do
155
+ use_vcr_cassette 'ipcommerce/certification/terminal/c-setup'
156
+ it "clears captures" do
157
+ gateway.capture_all(options)
158
+ end
159
+ end
160
+
161
+ it "outputs the result" do
162
+ puts IpcommerceTransaction.new("#{batch}_C1", c1_authorization).print
163
+ puts IpcommerceTransaction.new("#{batch}_C2", c2_void).print
164
+ puts IpcommerceTransaction.new("#{batch}_C3", c3_authorization).print
165
+ puts IpcommerceTransaction.new("#{batch}_C4", c4_capture_selective).print
166
+ puts IpcommerceTransaction.new("#{batch}_C5", c5_authorization).print
167
+ puts IpcommerceTransaction.new("#{batch}_C6", c6_void).print
168
+ puts IpcommerceTransaction.new("#{batch}_C7", c7_authorization).print
169
+ puts IpcommerceTransaction.new("#{batch}_C8", gateway.capture_all(options)).print
170
+ end
171
+ end
172
+
173
+ context "Non-Standard Card Tests" do
174
+ let(:d1_authorization) { gateway.authorize(nil, d1_credit_card, 17.00, options) }
175
+ let(:d1_credit_card) { Factory.build(:expires_credit_card, :card_number => '6011000995504101', :cvv_number => '111', :postal_code => '10101') }
176
+ let(:d2_authorization) { gateway.authorize(nil, d2_credit_card, 33.03, options) }
177
+ let(:d2_credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :postal_code => '10101') }
178
+ let(:d3_authorization) { gateway.authorize(nil, d3_credit_card, 34.02, options) }
179
+ let(:d3_credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :postal_code => '10101') }
180
+ let(:d4_authorization) { gateway.authorize(nil, d4_credit_card, 35.05, options) }
181
+ let(:d4_credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :postal_code => '10101') }
182
+
183
+ use_vcr_cassette 'ipcommerce/certification/terminal/d'
184
+
185
+ context 'setup' do
186
+ use_vcr_cassette 'ipcommerce/certification/terminal/d-setup'
187
+ it "clears captures" do
188
+ gateway.capture_all(options)
189
+ end
190
+ end
191
+
192
+ it "outputs the result" do
193
+ puts IpcommerceTransaction.new("#{batch}_D1", d1_authorization).print
194
+ puts IpcommerceTransaction.new("#{batch}_D2", d2_authorization).print
195
+ puts IpcommerceTransaction.new("#{batch}_D3", d3_authorization).print
196
+ puts IpcommerceTransaction.new("#{batch}_D4", d4_authorization).print
197
+ puts IpcommerceTransaction.new("#{batch}_D5", gateway.capture_all(options)).print
198
+ end
199
+ end
200
+
201
+
202
+ context "Voice Authorization Tests" do
203
+ let(:v1_authorization) { gateway.authorize(nil, v1_credit_card, 8.00, options.merge(:approval_code => 'ABC123')) }
204
+ let(:v1_credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111') }
205
+
206
+ use_vcr_cassette 'ipcommerce/certification/terminal/v'
207
+
208
+ context 'setup' do
209
+ use_vcr_cassette 'ipcommerce/certification/terminal/v-setup'
210
+ it "clears captures" do
211
+ gateway.capture_all(options)
212
+ end
213
+ end
214
+
215
+ it "outputs the result" do
216
+ puts IpcommerceTransaction.new("#{batch}_V1", v1_authorization).print
217
+ puts IpcommerceTransaction.new("#{batch}_V2", gateway.capture_all(options)).print
218
+ end
219
+ end
220
+
221
+
222
+ context "Secure Card Data Tokenization Tests" do
223
+ let(:i1_authorization) { gateway.authorize(nil, i1_credit_card, 1.00, options) }
224
+ let(:i1_credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :street_address => '1000 1st Av', :postal_code => '10101') }
225
+ let(:i2_authorization) { gateway.authorize(nil, i2_credit_card, 1.00, options) }
226
+ let(:i2_credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :cvv_number => '111', :postal_code => '10101') }
227
+ let(:i3_authorization) { gateway.authorize(nil, i3_credit_card, 1.00, options) }
228
+ let(:i3_credit_card) { Factory.build(:expires_credit_card, :card_number => '371449635398456', :cvv_number => '1111', :postal_code => '10101') }
229
+ let(:i5_authorization) { gateway.authorize(nil, i1_credit_card, 16.00, options) }
230
+ let(:i6_return_unlinked) { gateway.return_unlinked(nil, i1_credit_card, 18.00, options) }
231
+ let(:i7_authorization) { gateway.authorize(nil, i3_credit_card, 31.83, options) }
232
+
233
+ use_vcr_cassette 'ipcommerce/certification/terminal/i'
234
+
235
+ context 'setup' do
236
+ use_vcr_cassette 'ipcommerce/certification/terminal/i-setup'
237
+ it "clears captures" do
238
+ gateway.capture_all(options)
239
+ end
240
+ end
241
+
242
+ it "outputs the result" do
243
+ puts IpcommerceTransaction.new("#{batch}_I1", i1_authorization).print
244
+ puts IpcommerceTransaction.new("#{batch}_I2", i2_authorization).print
245
+ puts IpcommerceTransaction.new("#{batch}_I3", i3_authorization).print
246
+ puts IpcommerceTransaction.new("#{batch}_I4", gateway.capture_all(options)).print
247
+ puts IpcommerceTransaction.new("#{batch}_I5", i5_authorization).print
248
+ puts IpcommerceTransaction.new("#{batch}_I6", i6_return_unlinked).print
249
+ puts IpcommerceTransaction.new("#{batch}_I7", i7_authorization).print
250
+ puts IpcommerceTransaction.new("#{batch}_I8", gateway.capture_all(options)).print
251
+ end
252
+ end
253
+
254
+ context 'Transaction Management Services (TMS)' do
255
+ let(:t1_authorization) { gateway.authorize(nil, t1_credit_card, 30.00, options) }
256
+ let(:t1_credit_card) { Factory.build(:expires_credit_card, :card_number => '4111111111111111', :postal_code => '10101', :cvv_number => '111') }
257
+ let(:t2_refund) { gateway.return_unlinked(nil, t1_credit_card, 30.00, options) }
258
+
259
+ let(:t3_authorization) { gateway.authorize(nil, t3_credit_card, 30.00, options) }
260
+ let(:t3_credit_card) { Factory.build(:expires_credit_card, :card_number => '5454545454545454', :postal_code => '10101', :cvv_number => '111') }
261
+ let(:t4_void) { gateway.void(t3_authorization.id, options) }
262
+
263
+ let(:t5_authorization) { gateway.authorize(nil, t5_credit_card, 33.00, options) }
264
+ let(:t5_credit_card) { Factory.build(:expires_credit_card, :card_number => '6011000995504101', :postal_code => '10101', :cvv_number => '111') }
265
+ let(:t6_capture) { gateway.capture_selective([t5_authorization.id], [{ :id => t5_authorization.id, :amount => 35.00 }], options) }
266
+
267
+ let(:t7_authorization) { gateway.authorize(nil, t7_credit_card, 33.00, options) }
268
+ let(:t7_credit_card) { Factory.build(:expires_credit_card, :card_number => '371449635398456', :postal_code => '10101', :cvv_number => '111') }
269
+
270
+ let(:t8_refund) { gateway.refund(t5_authorization.id, 33.00, options) }
271
+
272
+ use_vcr_cassette 'ipcommerce/certification/terminal/t'
273
+
274
+ context 'setup' do
275
+ use_vcr_cassette 'ipcommerce/certification/terminal/t-setup'
276
+ it "clears captures" do
277
+ gateway.capture_all(options)
278
+ end
279
+ end
280
+
281
+ it "outputs the result" do
282
+ puts IpcommerceTransaction.new("#{batch}_T1", t1_authorization).print
283
+ puts IpcommerceTransaction.new("#{batch}_T2", t2_refund).print
284
+ puts IpcommerceTransaction.new("#{batch}_T3", t3_authorization).print
285
+ puts IpcommerceTransaction.new("#{batch}_T4", t4_void).print
286
+ puts IpcommerceTransaction.new("#{batch}_T5", t5_authorization).print
287
+ puts IpcommerceTransaction.new("#{batch}_T6", t6_capture).print
288
+ puts IpcommerceTransaction.new("#{batch}_T7", t7_authorization).print
289
+ puts IpcommerceTransaction.new("#{batch}_T8", t8_refund).print
290
+ puts IpcommerceTransaction.new("#{batch}_T9", gateway.capture_all(options)).print
291
+
292
+ gateway.query_batch
293
+ gateway.query_transactions_summary
294
+ gateway.query_transactions_families({ :transaction_ids => [t1_authorization.id]})
295
+ gateway.query_transaction_details({ :transaction_ids => [t1_authorization.id]})
296
+ end
297
+ end
298
+ end