Class: Vantiv::Api::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/vantiv/api/request.rb

Constant Summary collapse

ENDPOINT_XML_TRANSACTION_TYPE =
{
  :"payment/sp2/credit/v1/authorization" => :authorization,
  :"payment/sp2/credit/v1/authorizationCompletion" => :capture,
  :"payment/sp2/credit/v1/reversal" => :authReversal,
  :"payment/sp2/credit/v1/sale" => :sale,
  :"payment/sp2/credit/v1/credit" => :credit,
  :"payment/sp2/credit/v1/return" => :credit,
  :"payment/sp2/services/v1/paymentAccountCreate" => :registerTokenRequest,
  :"payment/sp2/credit/v1/void" => :void
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint:, body:, response_object:) ⇒ Request

Returns a new instance of Request.



16
17
18
19
20
21
22
# File 'lib/vantiv/api/request.rb', line 16

def initialize(endpoint:, body:, response_object:)
  @endpoint = endpoint
  @response_object = response_object
  @retry_count = 0

  @body = populated_request_body(body)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



3
4
5
# File 'lib/vantiv/api/request.rb', line 3

def body
  @body
end

Instance Method Details

#runObject



24
25
26
# File 'lib/vantiv/api/request.rb', line 24

def run
  run_request_with_retries
end

#run_requestObject



28
29
30
31
# File 'lib/vantiv/api/request.rb', line 28

def run_request
  http_response = send_request(build_request)
  populated_response(@response_object, http_response)
end