Class: Monri::Payments::StatusResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/monri/payments/status_response.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Response

#exception, exception, #exception=, #failed?

Constructor Details

#initialize(params) ⇒ StatusResponse

Returns a new instance of StatusResponse.

Parameters:

  • params (Hash)


6
7
8
9
10
11
# File 'lib/monri/payments/status_response.rb', line 6

def initialize(params)
  if params.has_key?(:payment_result)
    self[:payment_result] = PaymentResult.new(params.delete(:payment_result))
  end
  self.merge!(params)
end

Class Method Details

.createStatusResponse

Returns:

Raises:

  • (ArgumentError)


34
35
36
37
38
39
40
41
42
# File 'lib/monri/payments/status_response.rb', line 34

def self.create
  raise ArgumentError, 'Provide a block' unless block_given?

  begin
    StatusResponse.new(yield)
  rescue StandardError => e
    StatusResponse.new(exception: e)
  end
end

Instance Method Details

#client_secretString

Returns:

  • (String)


24
25
26
# File 'lib/monri/payments/status_response.rb', line 24

def client_secret
  self[:client_secret]
end

#payment_resultMonri::Payments::PaymentResult



29
30
31
# File 'lib/monri/payments/status_response.rb', line 29

def payment_result
  self[:payment_result]
end

#payment_statusString

Returns:

  • (String)


19
20
21
# File 'lib/monri/payments/status_response.rb', line 19

def payment_status
  self[:payment_status]
end

#statusString

Returns:

  • (String)


14
15
16
# File 'lib/monri/payments/status_response.rb', line 14

def status
  self[:status]
end