Module: Simpal::Payment::Authorization

Defined in:
lib/simpal/payment/authorization.rb

Overview

Class Method Summary collapse

Class Method Details

.capture(id, params = {}, headers: {}, client: nil) ⇒ Simpal::PayPalObject

Capture an authorized payment.

Parameters:

  • id (String)

    The ID of an authorized payment.

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

    The parameters for the capture 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:



30
31
32
33
# 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) ⇒ Simpal::PayPalObject

Reauthorize an authorized payment.

Parameters:

  • id (String)

    The ID of an authorized payment.

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

    The parameters for the reauthorize 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:



43
44
45
46
# 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) ⇒ Simpal::PayPalObject

Retrieve an authorized payment.

Parameters:

  • id (String)

    The ID of an authorized 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:



17
18
19
20
# 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) ⇒ Boolean

Void an authorized payment.

Parameters:

  • id (String)

    The ID of an authorized 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:

  • (Boolean)

    ‘true` when the authorization has been voided, `false` otherwise.



55
56
57
# File 'lib/simpal/payment/authorization.rb', line 55

def self.void(id, headers: {}, client: nil)
  API::Payments::Authorizations.void(id, headers: headers, client: client)
end