Class: CatarsePagarme::SlipController

Inherits:
ApplicationController show all
Defined in:
app/controllers/catarse_pagarme/slip_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
# File 'app/controllers/catarse_pagarme/slip_controller.rb', line 6

def create
  transaction = SlipTransaction.new(slip_attributes, payment).charge!

  render json: { boleto_url: transaction.boleto_url, payment_status: transaction.status, gateway_data: payment.gateway_data }
rescue PagarMe::PagarMeError => e
  raven_capture(e)
  render json: { boleto_url: nil, payment_status: 'failed', message: e.message }
end

#slip_dataObject



26
27
28
# File 'app/controllers/catarse_pagarme/slip_controller.rb', line 26

def slip_data
  render json: {slip_expiration_date: payment.slip_expiration_date.to_date}
end

#updateObject



15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/catarse_pagarme/slip_controller.rb', line 15

def update
  payment.generating_second_slip = true
  transaction = SlipTransaction.new(slip_attributes, payment).charge!
  respond_to do |format|
    format.html { redirect_to transaction.boleto_url }
    format.json do
      { boleto_url: transaction.boleto_url }
    end
  end
end