Class: CardConnect::Service::RefundResponse
- Inherits:
-
Object
- Object
- CardConnect::Service::RefundResponse
- Includes:
- Utils
- Defined in:
- lib/cardconnect/services/refund/refund_response.rb
Constant Summary collapse
- FIELDS =
[:merchid, :amount, :retref, :authcode, :respcode, :respproc, :respstat, :resptext].freeze
- STATUS_APPROVED =
'A'.freeze
- STATUS_RETRY =
'B'.freeze
- STATUS_DECLINED =
'C'.freeze
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(response) ⇒ RefundResponse
constructor
A new instance of RefundResponse.
- #success? ⇒ Boolean
Methods included from Utils
#set_attributes, #symbolize_keys
Constructor Details
#initialize(response) ⇒ RefundResponse
Returns a new instance of RefundResponse.
15 16 17 18 19 |
# File 'lib/cardconnect/services/refund/refund_response.rb', line 15 def initialize(response) set_attributes(response, FIELDS) @errors = [] process_errors end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
9 10 11 |
# File 'lib/cardconnect/services/refund/refund_response.rb', line 9 def errors @errors end |
Instance Method Details
#body ⇒ Object
25 26 27 |
# File 'lib/cardconnect/services/refund/refund_response.rb', line 25 def body FIELDS.collect{|attr| {attr => send(attr)} }.reduce({}, :merge) end |
#success? ⇒ Boolean
21 22 23 |
# File 'lib/cardconnect/services/refund/refund_response.rb', line 21 def success? errors.empty? end |