class Origami::PayparPaymentsController < BaseOrigamiController
	def create
		sale_id = params[:sale_id]
		redeem_amount = params[:redeem_amount]
		membership_id = params[:membership_id]
		payment_method = "paypar"
		if(Sale.exists?(sale_id))
			saleObj = Sale.find(sale_id)
      		sale_payment = SalePayment.new
      		status,msg =sale_payment.process_payment(saleObj, @user, redeem_amount,payment_method)
      		if status == true
      			@out = true, "Success!"
      		else
      			@out =false, "Please try again payment!"
      		end
      	else
      		@out = false, "There has no sale record!"
		end

	end
end
