Class: Unit::Resource::ReceivedPaymentResource

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/unit/api_resources/received_payment_resource.rb

Class Method Summary collapse

Methods inherited from BaseResource

file_response_handler, response_handler

Class Method Details

.advance_received_payment(payment_id) ⇒ UnitResponse, UnitError

Advance an ach payment by calling Unit’s API

Parameters:

  • payment_id (String)

Returns:



40
41
42
43
# File 'lib/unit/api_resources/received_payment_resource.rb', line 40

def advance_received_payment(payment_id)
  response = HttpHelper.post("#{api_url}/received-payments/#{payment_id}/advance", headers: headers)
  response_handler(response)
end

.get_payment(payment_id) ⇒ UnitResponse, UnitError

Get a received ach payment by calling Unit’s API

Parameters:

  • payment_id (String)

Returns:



15
16
17
18
# File 'lib/unit/api_resources/received_payment_resource.rb', line 15

def get_payment(payment_id)
  response = HttpHelper.get("#{api_url}/received-payments/#{payment_id}", headers: headers)
  response_handler(response)
end

.list_payments(params = nil) ⇒ UnitResponse, UnitError

List received ach payments by calling Unit’s API

Parameters:

  • params (ListAchPaymentParams) (defaults to: nil)

Returns:



23
24
25
26
# File 'lib/unit/api_resources/received_payment_resource.rb', line 23

def list_payments(params = nil)
  response = HttpHelper.get("#{api_url}/received-payments", params: params&.to_hash, headers: headers)
  response_handler(response)
end

.update_payment(request) ⇒ UnitResponse, UnitError

Update a received ach payment by calling Unit’s API

Parameters:

  • request (PatchReceivedPaymentRequest)

Returns:



31
32
33
34
35
# File 'lib/unit/api_resources/received_payment_resource.rb', line 31

def update_payment(request)
  payload = request.to_json_api
  response = HttpHelper.patch("#{api_url}/received-payments/#{request.payment_id}", body: payload, headers: headers)
  response_handler(response)
end