Class: Portmone::Responses::Finish3DS

Inherits:
Object
  • Object
show all
Defined in:
lib/portmone/responses/finish_3ds.rb

Constant Summary collapse

SUCCESS_STATUS =
'PAYED'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(faraday_response, currency:, timezone:) ⇒ Finish3DS

Returns a new instance of Finish3DS.



6
7
8
9
10
11
# File 'lib/portmone/responses/finish_3ds.rb', line 6

def initialize(faraday_response, currency:, timezone:)
  @response = faraday_response
  @currency = currency
  @timezone = timezone
  @response_body = @response.body.present? ? JSON.parse(@response.body) : { 'result' => {} }
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



4
5
6
# File 'lib/portmone/responses/finish_3ds.rb', line 4

def response
  @response
end

Instance Method Details

#acs_urlObject



33
34
35
# File 'lib/portmone/responses/finish_3ds.rb', line 33

def acs_url
  result['actionMPI']
end

#error_codeObject



21
22
23
# File 'lib/portmone/responses/finish_3ds.rb', line 21

def error_code
  result['errorCode']
end

#error_descriptionObject



25
26
27
# File 'lib/portmone/responses/finish_3ds.rb', line 25

def error_description
  result['error']
end

#http_statusObject



13
14
15
# File 'lib/portmone/responses/finish_3ds.rb', line 13

def http_status
  response.status
end

#mdObject



37
38
39
# File 'lib/portmone/responses/finish_3ds.rb', line 37

def md
  result['md']
end

#pa_reqObject



41
42
43
# File 'lib/portmone/responses/finish_3ds.rb', line 41

def pa_req
  result['pareq']
end

#required_3ds?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/portmone/responses/finish_3ds.rb', line 29

def required_3ds?
  result['isNeed3DS'] == 'Y'
end

#success?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/portmone/responses/finish_3ds.rb', line 17

def success?
  result['status'] == SUCCESS_STATUS && !required_3ds?
end