forked from AuthorizeNet/sdk-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed deprecated calls, added returned items
- Loading branch information
Showing
11 changed files
with
341 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module AuthorizeNet::Reporting | ||
|
||
class ReturnedItem | ||
include AuthorizeNet::Model | ||
|
||
attr_accessor :id, :date_utc, :date_local, :code, :description, :returned_items | ||
|
||
def date_utc=(time) | ||
if time.kind_of?(DateTime) | ||
@date_utc = time | ||
else | ||
@date_utc = DateTime.parse(time.to_s) | ||
end | ||
end | ||
|
||
def date_local=(time) | ||
if time.kind_of?(DateTime) | ||
@date_local = time | ||
else | ||
@date_local = DateTime.parse(time.to_s) | ||
end | ||
end | ||
|
||
def add_returned_item(id = nil, date_utc = nil, date_local = nil, code = nil, description = nil) | ||
if id.kind_of?(AuthorizeNet::Reporting::ReturnedItem) | ||
returned_item = id | ||
else | ||
returned_item = AuthorizeNet::Reporting::ReturnedItem.new({:return_item_id => id, :return_item_date_utc => date_utc, :return_item_date_utc => date_local, :return_item_code => code, :line_item_description => description}) | ||
end | ||
@returned_items = @returned_items.to_a << returned_item | ||
end | ||
|
||
def to_hash | ||
hash = { | ||
:id => @id, | ||
:date_utc => @date_utc, | ||
:date_local => @date_local, | ||
:code => @code, | ||
:description => @description, | ||
:returned_items => handle_multivalue_hashing(@returned_items) | ||
} | ||
hash.delete_if { |k, v| v.nil? } | ||
hash | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.