nimbleshop_authorizedotnet 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. data/README.md +24 -0
  2. data/app/controllers/nimbleshop_authorizedotnet/authorizedotnets_controller.rb +5 -2
  3. data/app/controllers/nimbleshop_authorizedotnet/payments_controller.rb +2 -1
  4. data/app/models/nimbleshop_authorizedotnet/authorizedotnet.rb +2 -2
  5. data/app/views/nimbleshop_authorizedotnet/authorizedotnets/_form.html.erb +4 -2
  6. data/app/views/nimbleshop_authorizedotnet/payments/_payment_info_for_buyer.html.erb +1 -1
  7. data/lib/nimbleshop_authorizedotnet.rb +4 -3
  8. data/lib/nimbleshop_authorizedotnet/gateway.rb +3 -5
  9. data/lib/nimbleshop_authorizedotnet/processor.rb +66 -17
  10. data/lib/nimbleshop_authorizedotnet/util.rb +31 -0
  11. data/lib/tasks/nimbleshop_authorizedotnet_tasks.rake +1 -1
  12. data/test/test_helper.rb +32 -0
  13. data/test/unit/payment_method_test.rb +21 -0
  14. data/test/unit/processor_test.rb +241 -0
  15. data/test/vcr_cassettes/authorize_net/authorize-failure.yml +38 -0
  16. data/test/vcr_cassettes/authorize_net/authorize-success.yml +38 -0
  17. data/test/vcr_cassettes/authorize_net/capture-failure.yml +38 -0
  18. data/test/vcr_cassettes/authorize_net/capture-success.yml +38 -0
  19. data/test/vcr_cassettes/authorize_net/purchase-failure.yml +38 -0
  20. data/test/vcr_cassettes/authorize_net/purchase-success.yml +38 -0
  21. data/test/vcr_cassettes/authorize_net/refund-failure.yml +38 -0
  22. data/test/vcr_cassettes/authorize_net/refund-success.yml +38 -0
  23. data/test/vcr_cassettes/authorize_net/void-authorize.yml +38 -0
  24. data/test/vcr_cassettes/authorize_net/void-failure.yml +38 -0
  25. data/test/vcr_cassettes/authorize_net/void-success.yml +38 -0
  26. metadata +43 -23
data/README.md CHANGED
@@ -4,6 +4,30 @@ This is Authorize.net extension for [nimbleShop](http://www.nimbleShop.org) .
4
4
 
5
5
  Please note that it does not support CIM feature of Authorize.net
6
6
 
7
+ # Dependencies
8
+
9
+ This gem relies on a model called `PaymentMethod` and this model should
10
+ have a column called `metadata` of type `text`. Given below is an
11
+ example that would work
12
+
13
+ ```
14
+ class CreatePaymentMethods < ActiveRecord::Migration
15
+ def change
16
+ create_table :payment_methods do |t|
17
+ t.string :name
18
+ t.text :description
19
+ t.string :type
20
+ t.string :permalink, null: false
21
+ t.text :metadata
22
+
23
+ t.timestamps
24
+ end
25
+ add_index :payment_methods, :permalink, unique: true
26
+ end
27
+ end
28
+ ```
29
+
30
+
7
31
  # Documentation
8
32
 
9
33
  Documentation is available at [http://nimbleshop.org/authorizedotnet.html](http://nimbleshop.org/authorizedotnet.html) .
@@ -1,6 +1,9 @@
1
1
  module NimbleshopAuthorizedotnet
2
2
 
3
- class AuthorizedotnetsController < ::Admin::PaymentMethodsController
3
+ # this line makes it possible to use this gem without nimbleshop_core
4
+ klass = defined?(::Admin::PaymentMethodsController) ? ::Admin::PaymentMethodsController : ActionController::Base
5
+
6
+ class AuthorizedotnetsController < klass
4
7
 
5
8
  before_filter :load_payment_method
6
9
 
@@ -35,7 +38,7 @@ module NimbleshopAuthorizedotnet
35
38
  private
36
39
 
37
40
  def post_params
38
- params.permit(authorizedotnet: [:mode, :ssl, :login_id, :transaction_key, :company_name_on_creditcard_statement])
41
+ params.permit(authorizedotnet: [:mode, :ssl, :login_id, :transaction_key, :business_name])
39
42
  end
40
43
 
41
44
  def load_payment_method
@@ -9,7 +9,8 @@ module NimbleshopAuthorizedotnet
9
9
  creditcard_attrs = params[:creditcard].merge(address_attrs)
10
10
  creditcard = Creditcard.new(creditcard_attrs)
11
11
 
12
- processor = NimbleshopAuthorizedotnet::Processor.new(order)
12
+ payment_method = NimbleshopAuthorizedotnet::Authorizedotnet.first
13
+ processor = NimbleshopAuthorizedotnet::Processor.new({order: order, payment_method: payment_method})
13
14
 
14
15
  default_action = Shop.current.default_creditcard_action
15
16
 
@@ -1,11 +1,11 @@
1
1
  module NimbleshopAuthorizedotnet
2
2
  class Authorizedotnet < PaymentMethod
3
3
 
4
- store_accessor :metadata, :login_id, :transaction_key, :company_name_on_creditcard_statement, :mode, :ssl
4
+ store_accessor :metadata, :login_id, :transaction_key, :business_name, :mode, :ssl
5
5
 
6
6
  before_save :set_mode, :set_ssl
7
7
 
8
- validates_presence_of :login_id, :transaction_key, :company_name_on_creditcard_statement
8
+ validates_presence_of :login_id, :transaction_key, :business_name
9
9
 
10
10
  def credentials
11
11
  { login: login_id, password: transaction_key }
@@ -21,9 +21,11 @@
21
21
  </div>
22
22
 
23
23
  <div class='control-group'>
24
- <%= f.label :company_name_on_creditcard_statement, nil, class: 'control-label' %>
24
+ <%= f.label :business_name, nil, class: 'control-label' %>
25
+ <%= link_to '?', '#', 'data-content' => 'Please enter the name of the company as it would appear in the credit card statement. If are not sure what name would appear in the credit card statements then consult your merchant account provider.',
26
+ 'data-original-title' => 'Business name' %>
25
27
  <div class='controls'>
26
- <%= f.text_field :company_name_on_creditcard_statement, class: 'span6' %>
28
+ <%= f.text_field :business_name, class: 'span6' %>
27
29
  </div>
28
30
  </div>
29
31
 
@@ -2,5 +2,5 @@
2
2
  Your credit card was charged <strong><%= number_to_currency(order.total_amount) %> </strong> .
3
3
  </li>
4
4
  <li>
5
- In the credit card statement name of the company would appear as <strong><%= order.payment_method.company_name_on_creditcard_statement %></strong> .
5
+ In the credit card statement name of the company would appear as <strong><%= order.payment_method.business_name %></strong> .
6
6
  </li>
@@ -1,6 +1,7 @@
1
- require "nimbleshop_authorizedotnet/engine"
1
+ require 'nimbleshop_authorizedotnet/engine'
2
2
 
3
3
  module NimbleshopAuthorizedotnet
4
- autoload :Processor, "nimbleshop_authorizedotnet/processor"
5
- autoload :Gateway, "nimbleshop_authorizedotnet/gateway"
4
+ autoload :Processor, 'nimbleshop_authorizedotnet/processor'
5
+ autoload :Gateway, 'nimbleshop_authorizedotnet/gateway'
6
+ autoload :Util, 'nimbleshop_authorizedotnet/util'
6
7
  end
@@ -1,11 +1,9 @@
1
1
  module NimbleshopAuthorizedotnet
2
2
  module Gateway
3
- def self.instance
4
- record = NimbleshopAuthorizedotnet::Authorizedotnet.first
3
+ def self.instance(payment_method)
4
+ ActiveMerchant::Billing::Gateway.logger = Rails.logger if payment_method.mode.to_s == 'test'
5
5
 
6
- ActiveMerchant::Billing::Gateway.logger = Rails.logger if record.mode.to_s == 'test'
7
-
8
- ActiveMerchant::Billing::AuthorizeNetGateway.new( record.credentials )
6
+ ActiveMerchant::Billing::AuthorizeNetGateway.new( payment_method.credentials )
9
7
  end
10
8
  end
11
9
  end
@@ -1,24 +1,30 @@
1
1
  module NimbleshopAuthorizedotnet
2
2
  class Processor < Processor::Base
3
3
 
4
- attr_reader :order, :payment_method, :errors
4
+ attr_reader :order, :payment_method, :errors, :gateway
5
5
 
6
- def gateway
7
- ::NimbleshopAuthorizedotnet::Gateway.instance
8
- end
9
-
10
- def initialize(order)
6
+ def initialize(options)
11
7
  @errors = []
12
- @order = order
13
- @payment_method = NimbleshopAuthorizedotnet::Authorizedotnet.first
8
+ @order = options.fetch(:order)
9
+ @payment_method = options.fetch(:payment_method)
10
+ @gateway = ::NimbleshopAuthorizedotnet::Gateway.instance(payment_method)
14
11
  end
15
12
 
16
13
  private
17
14
 
18
- def set_active_merchant_mode
15
+ def set_active_merchant_mode # :nodoc:
19
16
  ActiveMerchant::Billing::Base.mode = payment_method.mode.to_sym
20
17
  end
21
18
 
19
+ # Creates authorization for the order amount.
20
+ #
21
+ # === Options
22
+ #
23
+ # * <tt>:creditcard</tt> -- Credit card to be charged. This is a required field.
24
+ #
25
+ # This method returns false if authorization fails. Error messages are in <tt>errors</tt> array.
26
+ # If authorization succeeds then <tt>order.authorize</tt> is invoked.
27
+ #
22
28
  def do_authorize(options = {})
23
29
  options.symbolize_keys!
24
30
  options.assert_valid_keys(:creditcard)
@@ -30,7 +36,7 @@ module NimbleshopAuthorizedotnet
30
36
  return false
31
37
  end
32
38
 
33
- response = gateway.authorize(order.total_amount_in_cents, creditcard, order_id: order.number )
39
+ response = gateway.authorize(order.total_amount_in_cents, creditcard, Util.am_options(order))
34
40
  record_transaction(response, 'authorized', card_number: creditcard.display_number, cardtype: creditcard.cardtype)
35
41
 
36
42
  if response.success?
@@ -42,6 +48,15 @@ module NimbleshopAuthorizedotnet
42
48
  end
43
49
  end
44
50
 
51
+ # Creates purchase for the order amount.
52
+ #
53
+ # === Options
54
+ #
55
+ # * <tt>:creditcard</tt> -- Credit card to be charged. This is a required field.
56
+ #
57
+ # This method returns false if purchase fails. Error messages are in <tt>errors</tt> array.
58
+ # If purchase succeeds then <tt>order.purchase</tt> is invoked.
59
+ #
45
60
  def do_purchase(options = {})
46
61
  options.symbolize_keys!
47
62
  options.assert_valid_keys(:creditcard)
@@ -65,6 +80,15 @@ module NimbleshopAuthorizedotnet
65
80
  end
66
81
  end
67
82
 
83
+ # Captures the previously authorized transaction.
84
+ #
85
+ # === Options
86
+ #
87
+ # * <tt>:transaction_gid</tt> -- transaction_gid is the transaction id returned by the gateway. This is a required field.
88
+ #
89
+ # This method returns false if capture fails. Error messages are in <tt>errors</tt> array.
90
+ # If purchase succeeds then <tt>order.kapture</tt> is invoked.
91
+ #
68
92
  def do_kapture(options = {})
69
93
  options.symbolize_keys!
70
94
  options.assert_valid_keys(:transaction_gid)
@@ -76,11 +100,20 @@ module NimbleshopAuthorizedotnet
76
100
  if response.success?
77
101
  order.kapture
78
102
  else
79
- @errors << "Capture failed"
103
+ @errors << "Capture request failed"
80
104
  false
81
105
  end
82
106
  end
83
107
 
108
+ # Voids the previously authorized transaction.
109
+ #
110
+ # === Options
111
+ #
112
+ # * <tt>:transaction_gid</tt> -- transaction_gid is the transaction id returned by the gateway. This is a required field.
113
+ #
114
+ # This method returns false if void fails. Error messages are in <tt>errors</tt> array.
115
+ # If void succeeds then <tt>order.void</tt> is invoked.
116
+ #
84
117
  def do_void(options = {})
85
118
  options.symbolize_keys!
86
119
  options.assert_valid_keys(:transaction_gid)
@@ -89,11 +122,23 @@ module NimbleshopAuthorizedotnet
89
122
  response = gateway.void(transaction_gid, {})
90
123
  record_transaction(response, 'voided')
91
124
 
92
- response.success?.tap do |success|
93
- order.void if success
125
+ if response.success?
126
+ order.void
127
+ else
128
+ @errors << "Void operation failed"
129
+ false
94
130
  end
95
131
  end
96
132
 
133
+ # Refunds the given transaction.
134
+ #
135
+ # === Options
136
+ #
137
+ # * <tt>:transaction_gid</tt> -- transaction_gid is the transaction id returned by the gateway. This is a required field.
138
+ #
139
+ # This method returns false if refund fails. Error messages are in <tt>errors</tt> array.
140
+ # If refund succeeds then <tt>order.refund</tt> is invoked.
141
+ #
97
142
  def do_refund(options = {})
98
143
  options.symbolize_keys!
99
144
  options.assert_valid_keys(:transaction_gid, :card_number)
@@ -104,13 +149,16 @@ module NimbleshopAuthorizedotnet
104
149
  response = gateway.refund(order.total_amount_in_cents, transaction_gid, card_number: card_number)
105
150
  record_transaction(response, 'refunded')
106
151
 
107
- response.success?.tap do |success|
108
- order.refund if success
152
+ if response.success?
153
+ order.refund
154
+ else
155
+ @errors << "Refund failed"
156
+ false
109
157
  end
110
158
 
111
159
  end
112
160
 
113
- def record_transaction(response, operation, additional_options = {})
161
+ def record_transaction(response, operation, additional_options = {}) # :nodoc:
114
162
  #
115
163
  # Following code invokes response.authorization to get transaction id. Note that this method can be called
116
164
  # after capture or refund. And it feels weird to call +authorization+ when the operation was +capture+.
@@ -133,8 +181,9 @@ module NimbleshopAuthorizedotnet
133
181
  order.payment_transactions.create(options)
134
182
  end
135
183
 
136
- def valid_card?(creditcard)
184
+ def valid_card?(creditcard) # :nodoc:
137
185
  creditcard && creditcard.valid?
138
186
  end
187
+
139
188
  end
140
189
  end
@@ -0,0 +1,31 @@
1
+ module NimbleshopAuthorizedotnet
2
+ module Util
3
+ extend self
4
+
5
+ def billing_address(order)
6
+ { address1: order.real_billing_address.address1,
7
+ city: order.real_billing_address.city,
8
+ state: order.real_billing_address.state_name,
9
+ country: order.real_billing_address.country_name,
10
+ zip: order.real_billing_address.zipcode }
11
+ end
12
+
13
+ def shipping_address(order)
14
+ { first_name: order.shipping_address.first_name,
15
+ last_name: order.shipping_address.last_name,
16
+ address1: order.shipping_address.address1,
17
+ city: order.shipping_address.city,
18
+ state: order.shipping_address.state_name,
19
+ country: order.shipping_address.country_name,
20
+ zip: order.shipping_address.zipcode }
21
+ end
22
+
23
+ # In this method am stands for activemerchant
24
+ def am_options(order)
25
+ billing_address = { billing_address: billing_address(order) }
26
+ shipping_address = { shipping_address: shipping_address(order) }
27
+ misc = { order_id: order.number, email: order.email }
28
+ billing_address.merge(shipping_address).merge(misc)
29
+ end
30
+ end
31
+ end
@@ -20,7 +20,7 @@ namespace :nimbleshop_authorizedotnet do
20
20
  {
21
21
  login_id: Nimbleshop.config.authorizedotnet.login_id,
22
22
  transaction_key: Nimbleshop.config.authorizedotnet.transaction_key,
23
- company_name_on_creditcard_statement: 'Nimbleshop LLC',
23
+ business_name: 'Nimbleshop LLC',
24
24
  name: 'Authorize.net',
25
25
  permalink: 'authorizedotnet',
26
26
  description: %Q[<p> Authorize.Net is a payment gateway service provider allowing merchants to accept credit card and electronic checks paymentsn. Authorize.Net claims a user base of over 305,000 merchants, which would make them the Internet's largest payment gateway service provider. </p> <p> It also provides an instant test account which you can use while your application is being processed. </p>]
@@ -0,0 +1,32 @@
1
+ require 'bundler'
2
+ Bundler.setup(:test)
3
+
4
+ ENV["RAILS_ENV"] = "test"
5
+ require File.expand_path("../../../../nimbleshop_core/test/myshop/config/environment.rb", __FILE__)
6
+ require 'rails/test_help'
7
+ require 'active_record/fixtures'
8
+
9
+ require 'factory_girl'
10
+ Dir["#{File.dirname(__FILE__)}/../../../nimbleshop_core/test/factories/**"].each { |f| require File.expand_path(f) }
11
+
12
+ VCR.configure do | c |
13
+ c.ignore_hosts '127.0.0.1', 'localhost'
14
+ c.cassette_library_dir = 'test/vcr_cassettes'
15
+ c.hook_into :webmock # or :fakeweb
16
+ end
17
+
18
+ class ActiveSupport::TestCase
19
+ include FactoryGirl::Syntax::Methods
20
+ self.use_transactional_fixtures = false
21
+ setup do
22
+ DatabaseCleaner.start
23
+ ActiveRecord::Fixtures.create_fixtures("#{File.dirname(__FILE__)}/../../../nimbleshop_core/test/fixtures", ['shops', 'link_groups', 'payment_methods'])
24
+ end
25
+ teardown do
26
+ DatabaseCleaner.clean
27
+ end
28
+
29
+ def playcasette(casette)
30
+ VCR.use_cassette(casette) { yield }
31
+ end
32
+ end
@@ -0,0 +1,21 @@
1
+ require "test_helper"
2
+
3
+ class PaymentMethodAuthorizeNetTest < ActiveSupport::TestCase
4
+
5
+ test "validations" do
6
+ pm = NimbleshopAuthorizedotnet::Authorizedotnet.new(name: 'Authorize.net', description: 'this is description')
7
+ refute pm.valid?
8
+ expected = ["Business name can't be blank", "Login can't be blank", "Transaction key can't be blank"]
9
+ assert_equal expected, pm.errors.full_messages.sort
10
+ end
11
+
12
+ test "should save the record" do
13
+ pm = NimbleshopAuthorizedotnet::Authorizedotnet.new(name: 'Authorize.net', description: 'this is description')
14
+ pm.login_id = 'FWERSDEED093d'
15
+ pm.transaction_key = 'SDFSDFSFSF423433SDFSFSSFSFSF334'
16
+ pm.business_name = 'BigBinary LLC'
17
+ assert pm.save
18
+ assert_match /authorize-net/, pm.permalink
19
+ end
20
+
21
+ end
@@ -0,0 +1,241 @@
1
+ require 'test_helper'
2
+
3
+ module Processor
4
+ class NimbleshopAuthorizeNetAuthorizeTest < ActiveRecord::TestCase
5
+ setup do
6
+ payment_method = NimbleshopAuthorizedotnet::Authorizedotnet.first
7
+ @order = create(:order)
8
+ @order.stubs(:total_amount).returns(100.48)
9
+ @processor = NimbleshopAuthorizedotnet::Processor.new(order: @order, payment_method: payment_method)
10
+ end
11
+
12
+ test 'when authorization succeeds' do
13
+ creditcard = build(:creditcard)
14
+
15
+ playcasette('authorize.net/authorize-success') do
16
+ assert_equal true, @processor.authorize(creditcard: creditcard)
17
+ end
18
+
19
+ @order.reload
20
+
21
+ transaction = @order.payment_transactions.last
22
+ assert_equal 'authorized', transaction.operation
23
+ assert_equal true, transaction.success
24
+ assert_equal NimbleshopAuthorizedotnet::Authorizedotnet.first, @order.payment_method
25
+ assert @order.authorized?
26
+ end
27
+
28
+ test 'authorization fails when credit card number is not entered' do
29
+ creditcard = build(:creditcard, number: nil)
30
+ assert_equal false, @processor.authorize(creditcard: creditcard)
31
+ assert_equal 'Please enter credit card number', @processor.errors.first
32
+
33
+ @order.reload
34
+
35
+ assert_nil @order.payment_method
36
+ assert @order.abandoned?
37
+ end
38
+
39
+ test 'authorization fails with invalid credit card number' do
40
+ creditcard = build(:creditcard, number: 2)
41
+
42
+ playcasette('authorize.net/authorize-failure') do
43
+ assert_equal false, @processor.authorize(creditcard: creditcard)
44
+ assert_equal 'Credit card was declined. Please try again!', @processor.errors.first
45
+ end
46
+
47
+ @order.reload
48
+
49
+ assert_nil @order.payment_method
50
+ assert @order.abandoned?
51
+ end
52
+ end
53
+
54
+ class AuthorizeNetCaptureTest < ActiveRecord::TestCase
55
+ setup do
56
+ payment_method = NimbleshopAuthorizedotnet::Authorizedotnet.first
57
+ @order = create(:order, payment_method: payment_method)
58
+ @order.stubs(:total_amount).returns(100.48)
59
+ @processor = NimbleshopAuthorizedotnet::Processor.new(order: @order, payment_method: payment_method)
60
+ creditcard = build(:creditcard)
61
+
62
+ playcasette('authorize.net/authorize-success') do
63
+ @processor.authorize(creditcard: creditcard)
64
+ end
65
+
66
+ @tsx_id = @order.payment_transactions.last.transaction_gid
67
+ end
68
+
69
+ test 'when capture succeeds' do
70
+ creditcard = build(:creditcard)
71
+
72
+ playcasette('authorize.net/capture-success') do
73
+ assert_equal true, @processor.kapture(transaction_gid: @tsx_id)
74
+ end
75
+
76
+ @order.reload
77
+ transaction = @order.payment_transactions.last
78
+ assert_equal 'captured', transaction.operation
79
+ assert_equal true, transaction.success
80
+ assert @order.purchased?
81
+ end
82
+
83
+ test 'when capture fails' do
84
+ creditcard = build(:creditcard, number: 2)
85
+
86
+ playcasette('authorize.net/capture-failure') do
87
+ assert_equal false, @processor.kapture(transaction_gid: @tsx_id)
88
+ assert_equal 'Capture request failed', @processor.errors.first
89
+ end
90
+
91
+ @order.reload
92
+
93
+ transaction = @order.payment_transactions.last
94
+
95
+ assert_equal false, transaction.success
96
+ assert_equal 'captured', transaction.operation
97
+ assert @order.authorized?
98
+ end
99
+ end
100
+
101
+ class AuthorizeNetRefundTest < ActiveRecord::TestCase
102
+ setup do
103
+ payment_method = NimbleshopAuthorizedotnet::Authorizedotnet.first
104
+ @order = create(:order)
105
+ @order.stubs(:total_amount).returns(100.48)
106
+ @processor = NimbleshopAuthorizedotnet::Processor.new(order: @order, payment_method: payment_method)
107
+ creditcard = build(:creditcard)
108
+
109
+ playcasette('authorize.net/purchase-success') do
110
+ assert_equal true, @processor.purchase(creditcard: creditcard)
111
+ end
112
+
113
+ assert @order.reload.purchased?
114
+
115
+ @transaction = @order.payment_transactions.last
116
+ end
117
+
118
+ test 'when refund succeeds' do
119
+
120
+ playcasette('authorize.net/refund-success') do
121
+ assert_equal true, @processor.refund(transaction_gid: @transaction.transaction_gid,
122
+ card_number: @transaction.metadata[:card_number])
123
+ end
124
+
125
+ @order.reload
126
+ transaction = @order.payment_transactions.last
127
+
128
+ assert_equal 'refunded', transaction.operation
129
+ assert_equal true, transaction.success
130
+ assert_equal NimbleshopAuthorizedotnet::Authorizedotnet.first, @order.payment_method
131
+ assert @order.refunded?
132
+ end
133
+
134
+ test 'when refund fails' do
135
+
136
+ playcasette('authorize.net/refund-failure') do
137
+ assert_equal false, @processor.refund(transaction_gid: @transaction.transaction_gid, card_number: '1234')
138
+ end
139
+
140
+ @order.reload
141
+
142
+ transaction = @order.payment_transactions.last
143
+
144
+ assert_equal 'refunded', transaction.operation
145
+ assert_equal false, transaction.success
146
+ end
147
+ end
148
+
149
+ class AuthorizeNetVoidTest < ActiveRecord::TestCase
150
+ setup do
151
+ payment_method = NimbleshopAuthorizedotnet::Authorizedotnet.first
152
+ @order = create(:order)
153
+ @order.stubs(:total_amount).returns(100.48)
154
+ @processor = NimbleshopAuthorizedotnet::Processor.new(order: @order, payment_method: payment_method)
155
+ creditcard = build(:creditcard)
156
+
157
+ playcasette('authorize.net/authorize-success') do
158
+ assert_equal true, @processor.authorize(creditcard: creditcard)
159
+ end
160
+
161
+ @tsx_id = @order.payment_transactions.last.transaction_gid
162
+ end
163
+
164
+ test 'when capture succeeds' do
165
+ playcasette('authorize.net/void-success') do
166
+ assert_equal true, @processor.void(transaction_gid: @tsx_id)
167
+ end
168
+
169
+ @order.reload
170
+ transaction = @order.payment_transactions.last
171
+
172
+ assert_equal 'voided', transaction.operation
173
+ assert_equal true, transaction.success
174
+ assert_equal NimbleshopAuthorizedotnet::Authorizedotnet.first, @order.payment_method
175
+ assert @order.voided?
176
+ end
177
+
178
+ test 'when capture fails' do
179
+ playcasette('authorize.net/void-failure') do
180
+ assert_equal false, @processor.void(transaction_gid: @tsx_id)
181
+ end
182
+
183
+ @order.reload
184
+
185
+ transaction = @order.payment_transactions.last
186
+
187
+ assert_equal 'voided', transaction.operation
188
+ assert_equal false, transaction.success
189
+ end
190
+ end
191
+
192
+ class AuthorizeNetPurchaseTest < ActiveRecord::TestCase
193
+ setup do
194
+ payment_method = NimbleshopAuthorizedotnet::Authorizedotnet.first
195
+ @order = create(:order)
196
+ @order.stubs(:total_amount).returns(100.48)
197
+ @processor = NimbleshopAuthorizedotnet::Processor.new(order: @order, payment_method: payment_method)
198
+ end
199
+
200
+ test 'when purchase succeeds' do
201
+ creditcard = build(:creditcard)
202
+
203
+ playcasette('authorize.net/purchase-success') do
204
+ assert_equal true, @processor.purchase(creditcard: creditcard)
205
+ end
206
+
207
+ @order.reload
208
+
209
+ transaction = @order.payment_transactions.last
210
+ assert_equal 'purchased', transaction.operation
211
+ assert_equal true, transaction.success
212
+ assert @order.purchased?
213
+ end
214
+
215
+ test 'purchase fails when credit card number is not entered ' do
216
+ creditcard = build(:creditcard, number: nil)
217
+
218
+ playcasette('authorize.net/purchase-failure') do
219
+ assert_equal false, @processor.purchase(creditcard: creditcard)
220
+ assert_equal 'Please enter credit card number', @processor.errors.first
221
+ end
222
+
223
+ assert @order.abandoned?
224
+ end
225
+
226
+ test 'purchase fails when invalid credit card number is entered' do
227
+ creditcard = build(:creditcard, number: 2)
228
+
229
+ playcasette('authorize.net/purchase-failure') do
230
+ assert_equal false, @processor.purchase(creditcard: creditcard)
231
+ assert_equal 'Credit card was declined. Please try again!', @processor.errors.first
232
+ end
233
+
234
+ transaction = @order.payment_transactions.last
235
+
236
+ assert_equal false, transaction.success
237
+ assert_equal 'purchased', transaction.operation
238
+ assert @order.abandoned?
239
+ end
240
+ end
241
+ end
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://test.authorize.net/gateway/transact.dll
6
+ body:
7
+ encoding: US-ASCII
8
+ string: x_version=3.1&x_login=26Daqx7Jtw7R&x_tran_key=66JWf57KKc82W9y6&x_relay_response=FALSE&x_type=AUTH_ONLY&x_delim_data=TRUE&x_delim_char=%2C&x_encap_char=%24&x_invoice_num=&x_description=&x_card_num=2&x_card_code=123&x_exp_date=0413&x_first_name=Meda&x_last_name=McClure&x_amount=100.48&x_test_request=FALSE
9
+ headers:
10
+ Content-Type:
11
+ - application/x-www-form-urlencoded
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Sun, 22 Apr 2012 14:59:28 GMT
25
+ Server:
26
+ - Microsoft-IIS/6.0
27
+ X-Powered-By:
28
+ - ASP.NET
29
+ Content-Type:
30
+ - text/html
31
+ Content-Length:
32
+ - "307"
33
+ body:
34
+ encoding: US-ASCII
35
+ string: $3$,$1$,$6$,$The credit card number is invalid.$,$$,$P$,$0$,$$,$$,$100.48$,$CC$,$auth_only$,$$,$Meda$,$McClure$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$82AF683896C71D9FCD99BE1D5AFFEEA8$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$XXXX2$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$
36
+ http_version:
37
+ recorded_at: Sun, 22 Apr 2012 14:59:28 GMT
38
+ recorded_with: VCR 2.0.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://test.authorize.net/gateway/transact.dll
6
+ body:
7
+ encoding: US-ASCII
8
+ string: x_version=3.1&x_login=26Daqx7Jtw7R&x_tran_key=66JWf57KKc82W9y6&x_relay_response=FALSE&x_type=AUTH_ONLY&x_delim_data=TRUE&x_delim_char=%2C&x_encap_char=%24&x_invoice_num=&x_description=&x_card_num=4007000000027&x_card_code=123&x_exp_date=0413&x_first_name=Clarabelle&x_last_name=Stiedemann&x_amount=100.48&x_test_request=FALSE
9
+ headers:
10
+ Content-Type:
11
+ - application/x-www-form-urlencoded
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Sun, 22 Apr 2012 14:59:29 GMT
25
+ Server:
26
+ - Microsoft-IIS/6.0
27
+ X-Powered-By:
28
+ - ASP.NET
29
+ Content-Type:
30
+ - text/html
31
+ Content-Length:
32
+ - "341"
33
+ body:
34
+ encoding: US-ASCII
35
+ string: $1$,$1$,$1$,$This transaction has been approved.$,$FI4KFO$,$Y$,$2171213293$,$$,$$,$100.48$,$CC$,$auth_only$,$$,$Clarabelle$,$Stiedemann$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$C5FD3839F84A696E8F8727D8B387A800$,$P$,$2$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$XXXX0027$,$Visa$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$
36
+ http_version:
37
+ recorded_at: Sun, 22 Apr 2012 14:59:30 GMT
38
+ recorded_with: VCR 2.0.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://test.authorize.net/gateway/transact.dll
6
+ body:
7
+ encoding: US-ASCII
8
+ string: x_version=3.1&x_login=26Daqx7Jtw7R&x_tran_key=66JWf57KKc82W9y6&x_relay_response=FALSE&x_type=PRIOR_AUTH_CAPTURE&x_delim_data=TRUE&x_delim_char=%2C&x_encap_char=%24&x_trans_id=%7B%7D&x_amount=&x_test_request=FALSE
9
+ headers:
10
+ Content-Type:
11
+ - application/x-www-form-urlencoded
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Sun, 22 Apr 2012 15:19:50 GMT
25
+ Server:
26
+ - Microsoft-IIS/6.0
27
+ X-Powered-By:
28
+ - ASP.NET
29
+ Content-Type:
30
+ - text/html
31
+ Content-Length:
32
+ - "311"
33
+ body:
34
+ encoding: US-ASCII
35
+ string: $3$,$2$,$33$,$A valid referenced transaction ID is required.$,$$,$P$,$0$,$$,$$,$0.00$,$CC$,$prior_auth_capture$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$E4D08D153C02147DACEF435A63672D69$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$
36
+ http_version:
37
+ recorded_at: Sun, 22 Apr 2012 15:19:50 GMT
38
+ recorded_with: VCR 2.0.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://test.authorize.net/gateway/transact.dll
6
+ body:
7
+ encoding: US-ASCII
8
+ string: x_version=3.1&x_login=26Daqx7Jtw7R&x_tran_key=66JWf57KKc82W9y6&x_relay_response=FALSE&x_type=PRIOR_AUTH_CAPTURE&x_delim_data=TRUE&x_delim_char=%2C&x_encap_char=%24&x_trans_id=2171213293&x_amount=100.48&x_test_request=FALSE
9
+ headers:
10
+ Content-Type:
11
+ - application/x-www-form-urlencoded
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Sun, 22 Apr 2012 14:59:32 GMT
25
+ Server:
26
+ - Microsoft-IIS/6.0
27
+ X-Powered-By:
28
+ - ASP.NET
29
+ Content-Type:
30
+ - text/html
31
+ Content-Length:
32
+ - "315"
33
+ body:
34
+ encoding: US-ASCII
35
+ string: $1$,$1$,$311$,$This transaction has already been captured.$,$$,$P$,$0$,$$,$$,$100.48$,$CC$,$prior_auth_capture$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$82AF683896C71D9FCD99BE1D5AFFEEA8$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$Visa$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$
36
+ http_version:
37
+ recorded_at: Sun, 22 Apr 2012 14:59:33 GMT
38
+ recorded_with: VCR 2.0.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://test.authorize.net/gateway/transact.dll
6
+ body:
7
+ encoding: US-ASCII
8
+ string: x_version=3.1&x_login=26Daqx7Jtw7R&x_tran_key=66JWf57KKc82W9y6&x_relay_response=FALSE&x_type=AUTH_CAPTURE&x_delim_data=TRUE&x_delim_char=%2C&x_encap_char=%24&x_invoice_num=&x_description=&x_card_num=2&x_card_code=123&x_exp_date=0413&x_first_name=Nova&x_last_name=Weimann&x_amount=100.48&x_test_request=FALSE
9
+ headers:
10
+ Content-Type:
11
+ - application/x-www-form-urlencoded
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Sun, 22 Apr 2012 14:59:34 GMT
25
+ Server:
26
+ - Microsoft-IIS/6.0
27
+ X-Powered-By:
28
+ - ASP.NET
29
+ Content-Type:
30
+ - text/html
31
+ Content-Length:
32
+ - "310"
33
+ body:
34
+ encoding: US-ASCII
35
+ string: $3$,$1$,$6$,$The credit card number is invalid.$,$$,$P$,$0$,$$,$$,$100.48$,$CC$,$auth_capture$,$$,$Nova$,$Weimann$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$82AF683896C71D9FCD99BE1D5AFFEEA8$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$XXXX2$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$
36
+ http_version:
37
+ recorded_at: Sun, 22 Apr 2012 14:59:34 GMT
38
+ recorded_with: VCR 2.0.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://test.authorize.net/gateway/transact.dll
6
+ body:
7
+ encoding: US-ASCII
8
+ string: x_version=3.1&x_login=26Daqx7Jtw7R&x_tran_key=66JWf57KKc82W9y6&x_relay_response=FALSE&x_type=AUTH_CAPTURE&x_delim_data=TRUE&x_delim_char=%2C&x_encap_char=%24&x_invoice_num=&x_description=&x_card_num=4007000000027&x_card_code=123&x_exp_date=0413&x_first_name=Elias&x_last_name=Goldner&x_amount=100.48&x_test_request=FALSE
9
+ headers:
10
+ Content-Type:
11
+ - application/x-www-form-urlencoded
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Sun, 22 Apr 2012 14:59:35 GMT
25
+ Server:
26
+ - Microsoft-IIS/6.0
27
+ X-Powered-By:
28
+ - ASP.NET
29
+ Content-Type:
30
+ - text/html
31
+ Content-Length:
32
+ - "336"
33
+ body:
34
+ encoding: US-ASCII
35
+ string: $1$,$1$,$1$,$This transaction has been approved.$,$8XZB16$,$Y$,$2171213294$,$$,$$,$100.48$,$CC$,$auth_capture$,$$,$Elias$,$Goldner$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$B49F0B0B6E4EDB37B26F2618E8E3780A$,$P$,$2$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$XXXX0027$,$Visa$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$
36
+ http_version:
37
+ recorded_at: Sun, 22 Apr 2012 14:59:36 GMT
38
+ recorded_with: VCR 2.0.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://test.authorize.net/gateway/transact.dll
6
+ body:
7
+ encoding: US-ASCII
8
+ string: x_version=3.1&x_login=26Daqx7Jtw7R&x_tran_key=66JWf57KKc82W9y6&x_relay_response=FALSE&x_type=CREDIT&x_delim_data=TRUE&x_delim_char=%2C&x_encap_char=%24&x_trans_id=2171213294&x_card_num=1234&x_invoice_num=&x_description=&x_amount=100.48&x_test_request=FALSE
9
+ headers:
10
+ Content-Type:
11
+ - application/x-www-form-urlencoded
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Wed, 02 May 2012 19:52:39 GMT
25
+ Server:
26
+ - Microsoft-IIS/6.0
27
+ X-Powered-By:
28
+ - ASP.NET
29
+ Content-Type:
30
+ - text/html
31
+ Content-Length:
32
+ - "342"
33
+ body:
34
+ encoding: US-ASCII
35
+ string: $3$,$2$,$54$,$The referenced transaction does not meet the criteria for issuing a credit.$,$$,$P$,$0$,$$,$$,$100.48$,$CC$,$credit$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$82AF683896C71D9FCD99BE1D5AFFEEA8$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$XXXX1234$,$Visa$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$
36
+ http_version:
37
+ recorded_at: Wed, 02 May 2012 19:52:39 GMT
38
+ recorded_with: VCR 2.0.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://test.authorize.net/gateway/transact.dll
6
+ body:
7
+ encoding: US-ASCII
8
+ string: x_version=3.1&x_login=26Daqx7Jtw7R&x_tran_key=66JWf57KKc82W9y6&x_relay_response=FALSE&x_type=CREDIT&x_delim_data=TRUE&x_delim_char=%2C&x_encap_char=%24&x_trans_id=2171213294&x_card_num=XXXX-XXXX-XXXX-0027&x_invoice_num=&x_description=&x_amount=100.48&x_test_request=FALSE
9
+ headers:
10
+ Content-Type:
11
+ - application/x-www-form-urlencoded
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Wed, 02 May 2012 19:50:48 GMT
25
+ Server:
26
+ - Microsoft-IIS/6.0
27
+ X-Powered-By:
28
+ - ASP.NET
29
+ Content-Type:
30
+ - text/html
31
+ Content-Length:
32
+ - "310"
33
+ body:
34
+ encoding: US-ASCII
35
+ string: $1$,$1$,$1$,$This transaction has been approved.$,$$,$P$,$2171555499$,$$,$$,$100.48$,$CC$,$credit$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$DFF17287B2348D649D6F98C83DDA88CC$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$XXXX0027$,$Visa$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$
36
+ http_version:
37
+ recorded_at: Wed, 02 May 2012 19:50:48 GMT
38
+ recorded_with: VCR 2.0.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://test.authorize.net/gateway/transact.dll
6
+ body:
7
+ encoding: US-ASCII
8
+ string: x_version=3.1&x_login=26Daqx7Jtw7R&x_tran_key=66JWf57KKc82W9y6&x_relay_response=FALSE&x_type=AUTH_ONLY&x_delim_data=TRUE&x_delim_char=%2C&x_encap_char=%24&x_invoice_num=&x_description=&x_card_num=4007000000027&x_card_code=123&x_exp_date=0413&x_first_name=Kamille&x_last_name=Quitzon&x_amount=100.48&x_test_request=FALSE
9
+ headers:
10
+ Content-Type:
11
+ - application/x-www-form-urlencoded
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Sun, 22 Apr 2012 14:59:38 GMT
25
+ Server:
26
+ - Microsoft-IIS/6.0
27
+ X-Powered-By:
28
+ - ASP.NET
29
+ Content-Type:
30
+ - text/html
31
+ Content-Length:
32
+ - "335"
33
+ body:
34
+ encoding: US-ASCII
35
+ string: $1$,$1$,$1$,$This transaction has been approved.$,$G2TLJZ$,$Y$,$2171213295$,$$,$$,$100.48$,$CC$,$auth_only$,$$,$Kamille$,$Quitzon$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$B745627AB73112658026B8D5DFA807B3$,$P$,$2$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$XXXX0027$,$Visa$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$
36
+ http_version:
37
+ recorded_at: Sun, 22 Apr 2012 14:59:39 GMT
38
+ recorded_with: VCR 2.0.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://test.authorize.net/gateway/transact.dll
6
+ body:
7
+ encoding: US-ASCII
8
+ string: x_version=3.1&x_login=26Daqx7Jtw7R&x_tran_key=66JWf57KKc82W9y6&x_relay_response=FALSE&x_type=VOID&x_delim_data=TRUE&x_delim_char=%2C&x_encap_char=%24&x_trans_id=&x_test_request=FALSE
9
+ headers:
10
+ Content-Type:
11
+ - application/x-www-form-urlencoded
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Sun, 22 Apr 2012 15:24:10 GMT
25
+ Server:
26
+ - Microsoft-IIS/6.0
27
+ X-Powered-By:
28
+ - ASP.NET
29
+ Content-Type:
30
+ - text/html
31
+ Content-Length:
32
+ - "297"
33
+ body:
34
+ encoding: US-ASCII
35
+ string: $3$,$2$,$33$,$A valid referenced transaction ID is required.$,$$,$P$,$0$,$$,$$,$0.00$,$CC$,$void$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$E4D08D153C02147DACEF435A63672D69$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$
36
+ http_version:
37
+ recorded_at: Sun, 22 Apr 2012 15:24:10 GMT
38
+ recorded_with: VCR 2.0.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://test.authorize.net/gateway/transact.dll
6
+ body:
7
+ encoding: US-ASCII
8
+ string: x_version=3.1&x_login=26Daqx7Jtw7R&x_tran_key=66JWf57KKc82W9y6&x_relay_response=FALSE&x_type=VOID&x_delim_data=TRUE&x_delim_char=%2C&x_encap_char=%24&x_trans_id=2171213295&x_test_request=FALSE
9
+ headers:
10
+ Content-Type:
11
+ - application/x-www-form-urlencoded
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Sun, 22 Apr 2012 14:59:40 GMT
25
+ Server:
26
+ - Microsoft-IIS/6.0
27
+ X-Powered-By:
28
+ - ASP.NET
29
+ Content-Type:
30
+ - text/html
31
+ Content-Length:
32
+ - "312"
33
+ body:
34
+ encoding: US-ASCII
35
+ string: $1$,$1$,$1$,$This transaction has been approved.$,$G2TLJZ$,$P$,$2171213295$,$$,$$,$0.00$,$CC$,$void$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$3EBBB35F0951D7C0F4B9891489865793$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$XXXX0027$,$Visa$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$,$$
36
+ http_version:
37
+ recorded_at: Sun, 22 Apr 2012 14:59:40 GMT
38
+ recorded_with: VCR 2.0.0
metadata CHANGED
@@ -1,48 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nimbleshop_authorizedotnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Neeraj Singh
9
+ - megpha
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2012-07-13 00:00:00.000000000 Z
13
+ date: 2012-08-10 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: activemerchant
16
17
  requirement: !ruby/object:Gem::Requirement
17
18
  none: false
18
19
  requirements:
19
- - - ! '>='
20
+ - - ~>
20
21
  - !ruby/object:Gem::Version
21
- version: '0'
22
+ version: 1.26.0
22
23
  type: :runtime
23
24
  prerelease: false
24
25
  version_requirements: !ruby/object:Gem::Requirement
25
26
  none: false
26
27
  requirements:
27
- - - ! '>='
28
+ - - ~>
28
29
  - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: nimbleshop_core
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - '='
36
- - !ruby/object:Gem::Version
37
- version: 0.0.5
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - '='
44
- - !ruby/object:Gem::Version
45
- version: 0.0.5
30
+ version: 1.26.0
46
31
  description: Provides Authorize.net support to nimbleShop
47
32
  email:
48
33
  - neeraj@BigBinary.com
@@ -71,9 +56,24 @@ files:
71
56
  - lib/nimbleshop_authorizedotnet/engine.rb
72
57
  - lib/nimbleshop_authorizedotnet/gateway.rb
73
58
  - lib/nimbleshop_authorizedotnet/processor.rb
59
+ - lib/nimbleshop_authorizedotnet/util.rb
74
60
  - lib/nimbleshop_authorizedotnet.rb
75
61
  - lib/tasks/nimbleshop_authorizedotnet_tasks.rake
76
62
  - README.md
63
+ - test/test_helper.rb
64
+ - test/unit/payment_method_test.rb
65
+ - test/unit/processor_test.rb
66
+ - test/vcr_cassettes/authorize_net/authorize-failure.yml
67
+ - test/vcr_cassettes/authorize_net/authorize-success.yml
68
+ - test/vcr_cassettes/authorize_net/capture-failure.yml
69
+ - test/vcr_cassettes/authorize_net/capture-success.yml
70
+ - test/vcr_cassettes/authorize_net/purchase-failure.yml
71
+ - test/vcr_cassettes/authorize_net/purchase-success.yml
72
+ - test/vcr_cassettes/authorize_net/refund-failure.yml
73
+ - test/vcr_cassettes/authorize_net/refund-success.yml
74
+ - test/vcr_cassettes/authorize_net/void-authorize.yml
75
+ - test/vcr_cassettes/authorize_net/void-failure.yml
76
+ - test/vcr_cassettes/authorize_net/void-success.yml
77
77
  homepage: http://nimbleShop.org
78
78
  licenses: []
79
79
  post_install_message:
@@ -86,16 +86,36 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
86
  - - ! '>='
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
+ segments:
90
+ - 0
91
+ hash: -4027251246364974235
89
92
  required_rubygems_version: !ruby/object:Gem::Requirement
90
93
  none: false
91
94
  requirements:
92
95
  - - ! '>='
93
96
  - !ruby/object:Gem::Version
94
97
  version: '0'
98
+ segments:
99
+ - 0
100
+ hash: -4027251246364974235
95
101
  requirements: []
96
102
  rubyforge_project:
97
103
  rubygems_version: 1.8.24
98
104
  signing_key:
99
105
  specification_version: 3
100
106
  summary: Authorize.net extension for nimbleshop
101
- test_files: []
107
+ test_files:
108
+ - test/test_helper.rb
109
+ - test/unit/payment_method_test.rb
110
+ - test/unit/processor_test.rb
111
+ - test/vcr_cassettes/authorize_net/authorize-failure.yml
112
+ - test/vcr_cassettes/authorize_net/authorize-success.yml
113
+ - test/vcr_cassettes/authorize_net/capture-failure.yml
114
+ - test/vcr_cassettes/authorize_net/capture-success.yml
115
+ - test/vcr_cassettes/authorize_net/purchase-failure.yml
116
+ - test/vcr_cassettes/authorize_net/purchase-success.yml
117
+ - test/vcr_cassettes/authorize_net/refund-failure.yml
118
+ - test/vcr_cassettes/authorize_net/refund-success.yml
119
+ - test/vcr_cassettes/authorize_net/void-authorize.yml
120
+ - test/vcr_cassettes/authorize_net/void-failure.yml
121
+ - test/vcr_cassettes/authorize_net/void-success.yml