Class: Rma::Payment::Gateway::DebitRequest
- Inherits:
-
Object
- Object
- Rma::Payment::Gateway::DebitRequest
- Defined in:
- lib/rma/payment/gateway/debit_request.rb
Overview
Authorization class for RMA Payment Gateway. Handles authentication and authorization for the RMA Payment Gateway client.
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#otp ⇒ Object
readonly
Returns the value of attribute otp.
-
#transaction_id ⇒ Object
readonly
Returns the value of attribute transaction_id.
Instance Method Summary collapse
-
#call(transaction_id, otp) ⇒ Object
Fetch debit request Returns the debit request string.
-
#initialize(client) ⇒ DebitRequest
constructor
A new instance of DebitRequest.
Constructor Details
#initialize(client) ⇒ DebitRequest
Returns a new instance of DebitRequest.
20 21 22 |
# File 'lib/rma/payment/gateway/debit_request.rb', line 20 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
18 19 20 |
# File 'lib/rma/payment/gateway/debit_request.rb', line 18 def client @client end |
#otp ⇒ Object (readonly)
Returns the value of attribute otp.
18 19 20 |
# File 'lib/rma/payment/gateway/debit_request.rb', line 18 def otp @otp end |
#transaction_id ⇒ Object (readonly)
Returns the value of attribute transaction_id.
18 19 20 |
# File 'lib/rma/payment/gateway/debit_request.rb', line 18 def transaction_id @transaction_id end |
Instance Method Details
#call(transaction_id, otp) ⇒ Object
Fetch debit request Returns the debit request string
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rma/payment/gateway/debit_request.rb', line 26 def call(transaction_id, otp) @transaction_id = transaction_id @otp = otp response = client.post(body: debit_request_body) validate_debit_request_response!(response) response["result"] rescue StandardError => e raise AuthenticationError, "Failed to fetch debit request: #{e.}" end |