Class: PaysonAPI::Response::Payment

Inherits:
Object
  • Object
show all
Defined in:
lib/payson_api/response/payment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Payment



6
7
8
9
10
# File 'lib/payson_api/response/payment.rb', line 6

def initialize(data)
  @envelope = Envelope.parse(data)
  @token = data['TOKEN']
  @errors = RemoteError.parse(data)
end

Instance Attribute Details

#envelopeObject

Returns the value of attribute envelope.



4
5
6
# File 'lib/payson_api/response/payment.rb', line 4

def envelope
  @envelope
end

#errorsObject

Returns the value of attribute errors.



4
5
6
# File 'lib/payson_api/response/payment.rb', line 4

def errors
  @errors
end

#tokenObject

Returns the value of attribute token.



4
5
6
# File 'lib/payson_api/response/payment.rb', line 4

def token
  @token
end

Instance Method Details

#forward_urlObject



16
17
18
19
# File 'lib/payson_api/response/payment.rb', line 16

def forward_url
  PAYSON_WWW_HOST % (PaysonAPI.test? ? 'test-www' : 'www') +
    PAYSON_WWW_PAY_FORWARD_URL % @token
end

#success?Boolean



12
13
14
# File 'lib/payson_api/response/payment.rb', line 12

def success?
  @envelope.ack == 'SUCCESS'
end