Class: Payu::Response
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Payu::Response
- Defined in:
- lib/payu/response.rb
Constant Summary collapse
- PATTERN =
/^(\w+):(?:[ ])?(.*)$/
Class Method Summary collapse
-
.parse(body) ⇒ Object
Parses text response from Payu gateway.
Instance Method Summary collapse
-
#completed? ⇒ Boolean
Checks if transaction was completed (payment received).
Class Method Details
.parse(body) ⇒ Object
Parses text response from Payu gateway
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/payu/response.rb', line 8 def self.parse(body) temp = body.gsub("\r", "") data = temp.scan(PATTERN) data_hash = {} data.each do |element| data_hash[element[0]] = element[1] end new(data_hash) end |
Instance Method Details
#completed? ⇒ Boolean
Checks if transaction was completed (payment received)
21 22 23 |
# File 'lib/payu/response.rb', line 21 def completed? trans_status.to_i == 99 end |