Sha256: 5a849b3eb1cbcb6991630bab708338daf2b7e3b90f5bdf5d440b8951bdec820e
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
class Kaui::ChargebacksController < ApplicationController def show @payment_id = params[:id] if @payment_id.present? data = Kaui::KillbillHelper::get_chargebacks_for_payment(@payment_id) if data.present? @chargeback = Kaui::Chargeback.new(data) else Rails.logger.warn("Did not get back chargebacks #{response_body}") end else flash[:notice] = "No id given" end end def new @payment_id = params[:payment_id] @account_id = params[:account_id] @invoice_id = params[:invoice_id] # @payment_attempt = Kaui::KillbillHelper::get_payment_attempt(@external_key, @invoice_id, @payment_id) @account = Kaui::KillbillHelper::get_account(@account_id) # TODO: get payment by payment id (no api at the moment) @payment = Kaui::KillbillHelper::get_payment(@invoice_id, @payment_id) @invoice = Kaui::KillbillHelper::get_invoice(@invoice_id) @chargeback = Kaui::Chargeback.new("payment_id" => @payment_id, "chargeback_amount" => @payment.amount) end def create account_id = params[:account_id] chargeback = Kaui::Chargeback.new(params[:chargeback]) if chargeback.present? success = Kaui::KillbillHelper::create_chargeback(chargeback, params[:reason], params[:comment]) if success flash[:info] = "Chargeback created" end end flash[:error] = "Could not process chargeback" redirect_to account_timeline_path(:id => params[:account_id]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kaui-0.0.2 | app/controllers/kaui/chargebacks_controller.rb |