Class: Portmone::Responses::MobilePay
- Inherits:
-
Object
- Object
- Portmone::Responses::MobilePay
- Defined in:
- lib/portmone/responses/mobile_pay.rb
Constant Summary collapse
- SUCCESS_STATUS =
'PAYED'.freeze
- CREATED_STATUS =
'CREATED'.freeze
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #acs_url ⇒ Object
- #created? ⇒ Boolean
- #error_code ⇒ Object
- #error_description ⇒ Object
- #http_status ⇒ Object
-
#initialize(faraday_response, currency:, timezone:) ⇒ MobilePay
constructor
A new instance of MobilePay.
- #md ⇒ Object
- #pa_req ⇒ Object
- #required_3ds? ⇒ Boolean
- #shop_bill_id ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(faraday_response, currency:, timezone:) ⇒ MobilePay
Returns a new instance of MobilePay.
7 8 9 10 11 12 |
# File 'lib/portmone/responses/mobile_pay.rb', line 7 def initialize(faraday_response, currency:, timezone:) @response = faraday_response @response_body = JSON.parse(@response.body) @currency = currency @timezone = timezone end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/portmone/responses/mobile_pay.rb', line 5 def response @response end |
Instance Method Details
#acs_url ⇒ Object
38 39 40 |
# File 'lib/portmone/responses/mobile_pay.rb', line 38 def acs_url result['actionMPI'] if required_3ds? end |
#created? ⇒ Boolean
22 23 24 |
# File 'lib/portmone/responses/mobile_pay.rb', line 22 def created? result['status'] == CREATED_STATUS end |
#error_code ⇒ Object
26 27 28 |
# File 'lib/portmone/responses/mobile_pay.rb', line 26 def error_code result['errorCode'] end |
#error_description ⇒ Object
30 31 32 |
# File 'lib/portmone/responses/mobile_pay.rb', line 30 def error_description result['error'] end |
#http_status ⇒ Object
14 15 16 |
# File 'lib/portmone/responses/mobile_pay.rb', line 14 def http_status response.status end |
#md ⇒ Object
42 43 44 |
# File 'lib/portmone/responses/mobile_pay.rb', line 42 def md result['md'] if required_3ds? end |
#pa_req ⇒ Object
46 47 48 |
# File 'lib/portmone/responses/mobile_pay.rb', line 46 def pa_req result['pareq'] if required_3ds? end |
#required_3ds? ⇒ Boolean
34 35 36 |
# File 'lib/portmone/responses/mobile_pay.rb', line 34 def required_3ds? created? && result['isNeed3DS'] == 'Y' end |
#shop_bill_id ⇒ Object
50 51 52 |
# File 'lib/portmone/responses/mobile_pay.rb', line 50 def shop_bill_id result['shopBillId'] end |
#success? ⇒ Boolean
18 19 20 |
# File 'lib/portmone/responses/mobile_pay.rb', line 18 def success? result['status'] == SUCCESS_STATUS end |