class PaymentTransactionsController < ApplicationController
  before_action :set_payment_transaction, only: [:show, :edit, :update, :destroy]

  respond_to :html

  def index
    @payment_transactions = PaymentTransaction.all
    respond_with(@payment_transactions)
  end

  def show
    respond_with(@payment_transaction)
  end

  def new
    @payment_transaction = PaymentTransaction.new
    respond_with(@payment_transaction)
  end

  def edit
  end

  def create
    @payment_transaction = PaymentTransaction.new(payment_transaction_params)
    @payment_transaction.save
    respond_with(@payment_transaction)
  end

  def update
    @payment_transaction.update(payment_transaction_params)
    respond_with(@payment_transaction)
  end

  def destroy
    @payment_transaction.destroy
    respond_with(@payment_transaction)
  end

  private
    def set_payment_transaction
      @payment_transaction = PaymentTransaction.find(params[:id])
    end

    def payment_transaction_params
      params.require(:payment_transaction).permit(:payment_cents, :bill_transaction_id, :payment_type_id)
    end
end
