module Simpal::API::Payments::Authorizations

@see developer.paypal.com/docs/api/payments/v2/#authorizations

Public Class Methods

capture(id, params = {}, headers: {}, client: nil) click to toggle source

Capture an authorized payment.

@param id [String] The ID of an authorized payment. @param params [Hash] The parameters for the capture request. @param headers [Hash] The custom headers to add to the request. @param client [Simpal::Client] The API client to make the request with. @return [Hash] A Hash representing the captured payment.

# File lib/simpal/api/payments/authorizations.rb, line 32
def self.capture(id, params = {}, headers: {}, client: nil)
  client = Simpal.client_for(client)
  response = client.connection.post("/v2/payments/authorizations/#{id}/capture", params, headers)
  response.body
end
reauthorize(id, params = {}, headers: {}, client: nil) click to toggle source

Reauthorize an authorized payment.

@param id [String] The ID of an authorized payment. @param params [Hash] The parameters for the reauthorize request. @param headers [Hash] The custom headers to add to the request. @param client [Simpal::Client] The API client to make the request with. @return [Hash] A Hash representing the reauthorized payment.

# File lib/simpal/api/payments/authorizations.rb, line 46
def self.reauthorize(id, params = {}, headers: {}, client: nil)
  client = Simpal.client_for(client)
  response = client.connection.post("/v2/payments/authorizations/#{id}/reauthorize", params, headers)
  response.body
end
retrieve(id, headers: {}, client: nil) click to toggle source

Retrieve an authorized payment.

@param id [String] The ID of an authorized payment. @param headers [Hash] The custom headers to add to the request. @param client [Simpal::Client] The API client to make the request with. @return [Hash] A Hash representing the authorized payment.

# File lib/simpal/api/payments/authorizations.rb, line 18
def self.retrieve(id, headers: {}, client: nil)
  client = Simpal.client_for(client)
  response = client.connection.get("/v2/payments/authorizations/#{id}", headers)
  response.body
end
void(id, headers: {}, client: nil) click to toggle source

Void an authorized payment.

@param id [String] The ID of an authorized payment. @param headers [Hash] The custom headers to add to the request. @param client [Simpal::Client] The API client to make the request with. @return [Hash] An empty hash.

# File lib/simpal/api/payments/authorizations.rb, line 59
def self.void(id, headers: {}, client: nil)
  client = Simpal.client_for(client)
  response = client.connection.post("/v2/payments/authorizations/#{id}/void", nil, headers)
  response.body
end