Sha256: c39b9fb46c1d2823b34037bfe28ab8c82a599c0ac9d3a362ebb7eded07bf9ee5

Contents?: true

Size: 649 Bytes

Versions: 2

Compression:

Stored size: 649 Bytes

Contents

require "mercado_pago_rails/mercado_pago_checkout"
require "mercado_pago_rails/mercado_pago_response"
require "mercado_pago_rails/version"

module MercadoPagoRails

  def generate_purchase(mercado_pago_object, urls = {})
    purchase = MercadoPagoHelper.mp.create_preference(get_data(mercado_pago_object, urls))
    mercado_pago_object.new_status(purchase['response']['error'] ? "error" : "pending")
    MercadoPagoResponse.new(purchase)
  end

  private
    def get_data(mercado_pago_object, urls)
      role = MercadoPagoCheckout.new(mercado_pago_object)
      role.generate(urls[:success_url], urls[:pending_url], urls[:failure_url])
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mercado_pago_rails-0.1.1 lib/mercado_pago_rails.rb
mercado_pago_rails-0.1.0 lib/mercado_pago_rails.rb