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