Module: Simpal::API::Payments::Captures

Defined in:
lib/simpal/api/payments/captures.rb

Overview

Class Method Summary collapse

Class Method Details

.refund(id, params = {}, headers: {}, client: nil) ⇒ Hash

Refund a captured payment.

Parameters:

  • id (String)

    The ID of a captured payment.

  • params (Hash) (defaults to: {})

    The parameters for the refund request.

  • headers (Hash) (defaults to: {})

    The custom headers to add to the request.

  • client (Simpal::Client) (defaults to: nil)

    The API client to make the request with.

Returns:

  • (Hash)

    A Hash representing the captured payment.



32
33
34
35
36
# File 'lib/simpal/api/payments/captures.rb', line 32

def self.refund(id, params = {}, headers: {}, client: nil)
  client = Simpal.client_for(client)
  response = client.connection.post("/v2/payments/captures/#{id}/refund", params, headers)
  response.body
end

.retrieve(id, headers: {}, client: nil) ⇒ Hash

Retrieve a captured payment.

Parameters:

  • id (String)

    The ID of a captured payment.

  • headers (Hash) (defaults to: {})

    The custom headers to add to the request.

  • client (Simpal::Client) (defaults to: nil)

    The API client to make the request with.

Returns:

  • (Hash)

    A Hash representing the captured payment.



18
19
20
21
22
# File 'lib/simpal/api/payments/captures.rb', line 18

def self.retrieve(id, headers: {}, client: nil)
  client = Simpal.client_for(client)
  response = client.connection.get("/v2/payments/captures/#{id}", headers)
  response.body
end