Module: Transbank::Webpay::Reader
- Included in:
- Response
- Defined in:
- lib/transbank/webpay/reader.rb
Constant Summary collapse
- RESPONSE_CODE =
{ get_transaction_result: { '0' => 'transacción aprobada', '-1' => 'rechazo de transacción', '-2' => 'transacción debe reintentarse', '-3' => 'error en transacción', '-4' => 'rechazo de transacción', '-5' => 'rechazo por error de tasa', '-6' => 'excede cupo máximo mensual', '-7' => 'excede límite diario por transacción', '-8' => 'rubro no autorizado' }, default: { '0' => 'aprobada', '-98' => 'Error' } }.freeze
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Instance Method Summary collapse
- #attributes? ⇒ Boolean
- #body ⇒ Object
- #doc ⇒ Object
- #response_code_display ⇒ Object
- #xml_error_display ⇒ Object
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
5 6 7 |
# File 'lib/transbank/webpay/reader.rb', line 5 def action @action end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
5 6 7 |
# File 'lib/transbank/webpay/reader.rb', line 5 def content @content end |
Instance Method Details
#attributes? ⇒ Boolean
41 42 43 |
# File 'lib/transbank/webpay/reader.rb', line 41 def attributes? xml_return != "" end |
#body ⇒ Object
33 34 35 |
# File 'lib/transbank/webpay/reader.rb', line 33 def body content.body end |
#doc ⇒ Object
25 26 27 |
# File 'lib/transbank/webpay/reader.rb', line 25 def doc @doc ||= Nokogiri::XML body end |
#response_code_display ⇒ Object
29 30 31 |
# File 'lib/transbank/webpay/reader.rb', line 29 def response_code_display RESPONSE_CODE.fetch(action, RESPONSE_CODE[:default]).fetch(response_code, response_code) end |
#xml_error_display ⇒ Object
37 38 39 |
# File 'lib/transbank/webpay/reader.rb', line 37 def xml_error_display xml_error.map { |e| e.text.gsub(/<!--|-->/, '').strip } end |