Module: Mercadopago::Core::Payments

Included in:
Api
Defined in:
lib/mercadopago/core/payments.rb

Instance Method Summary collapse

Instance Method Details

#get_payment(payment_id) ⇒ Object



4
5
6
7
# File 'lib/mercadopago/core/payments.rb', line 4

def get_payment(payment_id)
  filters = { access_token: @access_token }
  get_request("/v1/payments/#{payment_id}", filters).body
end

#get_payment_request(payment_request_id) ⇒ Object



21
22
23
24
# File 'lib/mercadopago/core/payments.rb', line 21

def get_payment_request(payment_request_id)
  filters = { access_token: @access_token }
  get_request("/money_requests/#{payment_request_id}", filters).body
end

#request_payment(attrs = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/mercadopago/core/payments.rb', line 14

def request_payment(attrs={})
  payload = attrs.to_json
  headers = { content_type: :json }

  post_request("/money_requests?access_token=#{@access_token}", payload, headers).body
end

#search_payments(filters = {}) ⇒ Object



9
10
11
12
# File 'lib/mercadopago/core/payments.rb', line 9

def search_payments(filters={})
  filters.merge!({ access_token: @access_token })
  get_request('/v1/payments/search', filters).body
end