module Simpal::Payment::Authorization

@see Simpal::API::Payments::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 [Simpal::PayPalObject] An object representing the captured payment.

# File lib/simpal/payment/authorization.rb, line 30
def self.capture(id, params = {}, headers: {}, client: nil)
  resource = API::Payments::Authorizations.capture(id, params, headers: headers, client: client)
  PayPalObject.new(resource)
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 [Simpal::PayPalObject] An object representing the reauthorized payment.

# File lib/simpal/payment/authorization.rb, line 43
def self.reauthorize(id, params = {}, headers: {}, client: nil)
  resource = API::Payments::Authorizations.reauthorize(id, params, headers: headers, client: client)
  PayPalObject.new(resource)
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 [Simpal::PayPalObject] An object representing the authorized payment.

# File lib/simpal/payment/authorization.rb, line 17
def self.retrieve(id, headers: {}, client: nil)
  resource = API::Payments::Authorizations.retrieve(id, headers: headers, client: client)
  PayPalObject.new(resource)
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 [Boolean] `true` if the authorization was voided, else an exception is raised.

# File lib/simpal/payment/authorization.rb, line 55
def self.void(id, headers: {}, client: nil)
  API::Payments::Authorizations.void(id, headers: headers, client: client)
  true
end