Class: PaymentsApi::Requests::CreateCardPayment
- Inherits:
-
Object
- Object
- PaymentsApi::Requests::CreateCardPayment
- Includes:
- Traits::ApiRequest
- Defined in:
- lib/payments_api/requests/create_card_payment.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#optional_details ⇒ Object
readonly
Returns the value of attribute optional_details.
-
#reference ⇒ Object
readonly
Returns the value of attribute reference.
-
#return_url ⇒ Object
readonly
Returns the value of attribute return_url.
Instance Method Summary collapse
-
#call ⇒ Responses::PaymentResult
Create a new payment.
- #endpoint ⇒ Object
-
#initialize(amount:, reference:, description:, return_url:, **optional_details) ⇒ PaymentsApi::Requests::CreateCardPayment
constructor
Instantiate a new payment.
- #payload ⇒ Object
Constructor Details
#initialize(amount:, reference:, description:, return_url:, **optional_details) ⇒ PaymentsApi::Requests::CreateCardPayment
Instantiate a new payment
30 31 32 33 34 35 36 37 |
# File 'lib/payments_api/requests/create_card_payment.rb', line 30 def initialize(amount:, reference:, description:, return_url:, **optional_details) @optional_details = optional_details @amount = amount @reference = reference @description = description @return_url = return_url end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
8 9 10 |
# File 'lib/payments_api/requests/create_card_payment.rb', line 8 def amount @amount end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/payments_api/requests/create_card_payment.rb', line 8 def description @description end |
#optional_details ⇒ Object (readonly)
Returns the value of attribute optional_details.
8 9 10 |
# File 'lib/payments_api/requests/create_card_payment.rb', line 8 def optional_details @optional_details end |
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
8 9 10 |
# File 'lib/payments_api/requests/create_card_payment.rb', line 8 def reference @reference end |
#return_url ⇒ Object (readonly)
Returns the value of attribute return_url.
8 9 10 |
# File 'lib/payments_api/requests/create_card_payment.rb', line 8 def return_url @return_url end |
Instance Method Details
#call ⇒ Responses::PaymentResult
Create a new payment
47 48 49 50 51 |
# File 'lib/payments_api/requests/create_card_payment.rb', line 47 def call Responses::PaymentResult.new( http_client.post(endpoint, payload) ) end |
#endpoint ⇒ Object
53 54 55 |
# File 'lib/payments_api/requests/create_card_payment.rb', line 53 def endpoint '/v1/payments' end |
#payload ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/payments_api/requests/create_card_payment.rb', line 57 def payload { amount: amount, reference: reference, description: description, return_url: return_url }.merge( optional_details ) end |