Class: ActiveMerchant::Billing::AdaptivePaymentResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb

Constant Summary collapse

SUCCESS =
'Success'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ AdaptivePaymentResponse

Returns a new instance of AdaptivePaymentResponse.



13
14
15
16
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 13

def initialize(json)
  @json = json
  @response_rash = Hashie::Rash.new(MultiJson.decode(json))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



18
19
20
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 18

def method_missing(method, *args, &block)
  @response_rash.send(method, *args, &block)
end

Instance Attribute Details

#jsonObject (readonly) Also known as: raw

Returns the value of attribute json.



10
11
12
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 10

def json
  @json
end

Instance Method Details

#ackObject

def redirect_url_for

Base.gateway_mode == :test ? (TEST_REDIRECT_URL + pay_key) : (REDIRECT_URL + pay_key)

end



26
27
28
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 26

def ack
  response_envelope.ack
end

#buildObject



34
35
36
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 34

def build
  response_envelope.build
end

#correlation_idObject Also known as: correlationId



38
39
40
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 38

def correlation_id
  response_envelope.correlation_id
end

#success?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 43

def success?
  ack == SUCCESS
end

#timestampObject



30
31
32
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 30

def timestamp
  response_envelope.timestamp
end