lib/dineromail/status_report.rb in dineromail-0.1.2 vs lib/dineromail/status_report.rb in dineromail-0.1.3
- old
+ new
@@ -6,12 +6,12 @@
class StatusReport
attr_accessor :transaction_id
include HappyMapper
- tag 'REPORTE'
- element :report_status, Integer, :tag => 'ESTADOREPORTE'
+ tag 'reporte'
+ element :report_status, Integer, :tag => 'estadoreporte'
has_many :operations, Operation
VALID_REPORT_STATUS = 1
MALFORMED_REPORT_STATUS = 2
INVALID_ACCOUNT_NUMBER_REPORT_STATUS = 3
@@ -31,9 +31,15 @@
options = options.symbolize_keys
ipn_url = options[:ipn_webservice_url] || Dineromail.configuration.ipn_webservice_url
request_data = xml_request_for(transaction_id,options)
response = HTTParty.get ipn_url , :query => {:data => request_data}
self.parse response.body
+ end
+
+ def self.parse(xml)
+ #Convert tags to lowercase
+ xml = xml.gsub(/<(.*?)[> ]/){|tag| tag.downcase}
+ super(xml)
end
def self.xml_request_for(transaction_id,options = {})
options = options.symbolize_keys
account_number = options[:account_number] || Dineromail.configuration.account_number
\ No newline at end of file