Skip to content

Commit 330dadd

Browse files
authored
Merge pull request #150 from AuthorizeNet/revert-131-bug-order-class-missing-attrs
Revert "adds missing attr_accessors to AuthorizeNet::Order class"
2 parents d1113ec + 430667c commit 330dadd

2 files changed

Lines changed: 9 additions & 42 deletions

File tree

lib/authorize_net/order.rb

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
module AuthorizeNet
2-
2+
33
# Models an order.
44
class Order
5-
5+
66
include AuthorizeNet::Model
7-
8-
attr_accessor :invoice_num, :description, :tax, :tax_amount, :tax_name, :tax_description, :freight, :freight_name, :freight_description, :duty, :duty_amount, :duty_name, :duty_description, :tax_exempt, :po_num, :line_items
9-
attr_accessor :shipping_amount, :shipping_name, :shipping_description
10-
7+
8+
attr_accessor :invoice_num, :description, :tax, :tax_name, :tax_description, :freight, :freight_name, :freight_description, :duty, :duty_name, :duty_description, :tax_exempt, :po_num, :line_items
9+
1110
def add_line_item(id = nil, name = nil, description = nil, quantity = nil, price = nil, taxable = nil)
1211
if id.kind_of?(AuthorizeNet::LineItem)
1312
line_item = id
@@ -16,33 +15,28 @@ def add_line_item(id = nil, name = nil, description = nil, quantity = nil, price
1615
end
1716
@line_items = @line_items.to_a << line_item
1817
end
19-
18+
2019
def to_hash
2120
hash = {
2221
:invoice_num => @invoice_num,
2322
:description => @description,
2423
:tax => @tax,
25-
:tax_amount => @tax_amount,
2624
:tax_name => @tax_name,
2725
:tax_description => @tax_description,
2826
:freight => @freight,
2927
:freight_name => @freight_name,
3028
:freight_description => @freight_description,
3129
:duty => @duty,
32-
:duty_amount => @duty_amount,
3330
:duty_name => @duty_name,
3431
:duty_description => @duty_description,
35-
:shipping_amount => @shipping_amount,
36-
:shipping_name => @shipping_name,
37-
:shipping_description => @shipping_description,
3832
:tax_exempt => @tax_exempt,
3933
:po_num => @po_num,
4034
:line_items => handle_multivalue_hashing(@line_items)
4135
}
4236
hash.delete_if {|k, v| v.nil?}
4337
hash
4438
end
45-
39+
4640
end
47-
48-
end
41+
42+
end

spec/reporting_spec.rb

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -368,21 +368,6 @@
368368
</order>
369369
<authAmount>10.00</authAmount>
370370
<settleAmount>10.00</settleAmount>
371-
<tax>
372-
<amount>0.00</amount>
373-
<name>tax name</name>
374-
<description>tax description</description>
375-
</tax>
376-
<shipping>
377-
<amount>0.00</amount>
378-
<name>shipping name</name>
379-
<description>shipping description</description>
380-
</shipping>
381-
<duty>
382-
<amount>0.00</amount>
383-
<name>duty name</name>
384-
<description>duty description</description>
385-
</duty>
386371
<lineItems>
387372
<lineItem>
388373
<itemId>ITEM00001</itemId>
@@ -453,18 +438,6 @@
453438
transaction.order.line_items[0].should be_kind_of(AuthorizeNet::LineItem)
454439
transaction.order.tax_exempt.should be_falsey
455440

456-
transaction.order.tax_amount.should == 0.00
457-
transaction.order.tax_name.should == 'tax name'
458-
transaction.order.tax_description.should == 'tax description'
459-
460-
transaction.order.duty_amount.should == 0.00
461-
transaction.order.duty_name.should == 'duty name'
462-
transaction.order.duty_description.should == 'duty description'
463-
464-
transaction.order.shipping_amount.should == 0.00
465-
transaction.order.shipping_name.should == 'shipping name'
466-
transaction.order.shipping_description.should == 'shipping description'
467-
468441
transaction.payment_method.should be_kind_of(AuthorizeNet::CreditCard)
469442
transaction.payment_method.card_number.should == 'XXXX1111'
470443

0 commit comments

Comments
 (0)