Class: Mercadopago::Payment

Inherits:
MPBase
  • Object
show all
Defined in:
lib/mercadopago/resources/payment.rb

Overview

Instance Method Summary collapse

Methods inherited from MPBase

#_check_headers, #_check_request_options, #_delete, #_get, #_post, #_put, #initialize

Constructor Details

This class inherits a constructor from Mercadopago::MPBase

Instance Method Details

#create(payment_data, request_options: nil) ⇒ Object

Raises:

  • (TypeError)


23
24
25
26
27
# File 'lib/mercadopago/resources/payment.rb', line 23

def create(payment_data, request_options: nil)
  raise TypeError, 'Param payment_data must be a Hash' unless payment_data.is_a?(Hash)

  _post(uri: '/v1/payments/', data: payment_data, request_options: request_options)
end

#get(payment_id, request_options: nil) ⇒ Object



19
20
21
# File 'lib/mercadopago/resources/payment.rb', line 19

def get(payment_id, request_options: nil)
  _get(uri: "/v1/payments/#{payment_id}", request_options: request_options)
end

#search(filters: nil, request_options: nil) ⇒ Object

Raises:

  • (TypeError)


13
14
15
16
17
# File 'lib/mercadopago/resources/payment.rb', line 13

def search(filters: nil, request_options: nil)
  raise TypeError, 'Param filters must be a Hash' unless filters.nil? || filters.is_a?(Hash)

  _get(uri: '/v1/payments/search', filters: filters, request_options: request_options)
end

#update(payment_id, payment_data, request_options: nil) ⇒ Object

Raises:

  • (TypeError)


29
30
31
32
33
# File 'lib/mercadopago/resources/payment.rb', line 29

def update(payment_id, payment_data, request_options: nil)
  raise TypeError, 'Param payment_data must be a Hash' unless payment_data.is_a?(Hash)

  _put(uri: "/v1/payments/#{payment_id}", data: payment_data, request_options: request_options)
end