Class: Tamara::Payments::Capture

Inherits:
ApplicationService show all
Includes:
JsonSchemas::Payments::Capture
Defined in:
lib/tamara/api/payments/capture.rb

Constant Summary

Constants included from JsonSchemas::Validator

JsonSchemas::Validator::ERROR_MESSAGES

Class Method Summary collapse

Instance Method Summary collapse

Methods included from JsonSchemas::Validator

#validate_params!

Methods inherited from ApplicationService

#call, #initialize

Methods included from Request

#api_token, #error_message, #handle_response_error, #headers, #parsed_response, #response_body, #response_status

Constructor Details

This class inherits a constructor from Tamara::ApplicationService

Class Method Details

.call(order_id:, total_amount:, shipping_info:, items: [], shipping_amount: nil, tax_amount: nil, discount_amount: nil, opts: {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/tamara/api/payments/capture.rb', line 6

def self.call(order_id:, total_amount:, shipping_info:, items: [], shipping_amount: nil, tax_amount: nil, discount_amount: nil, opts: {})
  new(order_id: order_id,
      total_amount: total_amount,
      shipping_info: shipping_info,
      items: items,
      shipping_amount: shipping_amount,
      tax_amount: tax_amount,
      discount_amount: discount_amount,
      opts: opts).call
end

Instance Method Details

#call_apiObject



17
18
19
# File 'lib/tamara/api/payments/capture.rb', line 17

def call_api
  ::Faraday.post(url, api_params.to_json, headers)
end