Sha256: 14a12eee48079fd03602ed714db8b08be3d62cb61819027ead5e3c143fafe6f0

Contents?: true

Size: 709 Bytes

Versions: 2

Compression:

Stored size: 709 Bytes

Contents

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

module MercadoPagoRails

  def generate_purchase(mercado_pago_object, urls = {})
    purchase = MercadoPagoRailsHelper.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.3 lib/mercado_pago_rails.rb
mercado_pago_rails-0.1.2 lib/mercado_pago_rails.rb