Class: Spree::BankSlipsController
- Inherits:
-
StoreController
- Object
- StoreController
- Spree::BankSlipsController
- Defined in:
- app/controllers/spree/bank_slips_controller.rb
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
8 9 10 11 |
# File 'app/controllers/spree/bank_slips_controller.rb', line 8 def show data = open(@slip.pdf) send_data data.read, filename: "boleto_#{@slip.id}.pdf", type: 'application/pdf' end |
#status_changed ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/spree/bank_slips_controller.rb', line 13 def status_changed if params[:data] case params[:data][:status].to_sym # Captura o pagamento when :paid then @slip.payment.capture! # Cancela o pagamento e o pedido when :canceled, :expired @slip.payment.void_transaction! # Pode ser que o pedido tenha sido completo por outro pagamento # esse e o motivo dessa verificacao @slip.order.cancel! if @slip.order.payment_state == 'balance_due' end end render nothing: true, status: 200 end |