For Pull
This commit is contained in:
@@ -9,11 +9,11 @@ class Api::BillController < Api::ApiController
|
||||
#create Bill by Booking ID
|
||||
if (params[:booking_id])
|
||||
@sale = Sale.new
|
||||
@status = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee.name)
|
||||
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee.name)
|
||||
|
||||
elsif (params[:order_id])
|
||||
@sale = Sale.new
|
||||
@status = @sale.generate_invoice_from_order(params[:order_id], current_login_employee.name)
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee.name)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,10 +38,10 @@ class Crm::CustomersController < ApplicationController
|
||||
def create
|
||||
|
||||
@crm_customers = Customer.new(customer_params)
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @crm_customers.save
|
||||
|
||||
|
||||
|
||||
name = customer_params[:name]
|
||||
phone = customer_params[:contact_no]
|
||||
@@ -63,12 +63,10 @@ class Crm::CustomersController < ApplicationController
|
||||
)
|
||||
|
||||
if response["status"] == true
|
||||
puts "hhhhhhhhhhhhhhhhhh"
|
||||
puts params[:sale_id]
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
|
||||
if params[:sale_id] != 0
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' }
|
||||
if params[:sale_id] != 0
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' }
|
||||
else
|
||||
format.html { redirect_to '/crm/customers/'+params[:sale_id]+'/assign_sale_id', notice: 'Customer was successfully created.' }
|
||||
end
|
||||
@@ -77,27 +75,27 @@ class Crm::CustomersController < ApplicationController
|
||||
|
||||
@crm_customers.destroy
|
||||
|
||||
if params[:sale_id] != 0
|
||||
if params[:sale_id] != 0
|
||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||
|
||||
|
||||
else
|
||||
format.html { redirect_to '/crm/customers/'+params[:sale_id]+'/assign_sale_id', notice: response["message"] }
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
# format.json { render :index, status: :created, location: @crm_customers }
|
||||
|
||||
else
|
||||
if params[:sale_id] != 0
|
||||
format.html { redirect_to crm_customers_path}
|
||||
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
|
||||
|
||||
|
||||
else
|
||||
format.html { redirect_to '/crm/customers/'+params[:sale_id]+'/assign_sale_id', notice: response["message"] }
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -105,7 +103,7 @@ class Crm::CustomersController < ApplicationController
|
||||
# PATCH/PUT /crm/customers/1
|
||||
# PATCH/PUT /crm/customers/1.json
|
||||
def update
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @crm_customer.update(customer_params)
|
||||
|
||||
@@ -118,7 +116,7 @@ class Crm::CustomersController < ApplicationController
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
app_token = membership.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + "/api/update_membership_customer".to_s
|
||||
|
||||
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
date_of_birth: date_of_birth,
|
||||
id: id}.to_json,
|
||||
@@ -127,7 +125,7 @@ class Crm::CustomersController < ApplicationController
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @crm_customer }
|
||||
|
||||
@@ -153,7 +151,7 @@ class Crm::CustomersController < ApplicationController
|
||||
# DELETE /crm/customers/1
|
||||
# DELETE /crm/customers/1.json
|
||||
def get_sale_id
|
||||
|
||||
|
||||
@sale_id = params[:sale_id]
|
||||
@crm_customers = Customer.all
|
||||
@crm_customer = Customer.new
|
||||
@@ -179,5 +177,3 @@ class Crm::CustomersController < ApplicationController
|
||||
params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_type, :membership_authentication_code)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, @user, cash)
|
||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,6 +18,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
sale_id = params[:sale_id]
|
||||
if Sale.exists?(sale_id)
|
||||
@sale_data = Sale.find_by_sale_id(sale_id)
|
||||
@sale_data.sale_payments.each do |spay|
|
||||
if spay.payment_method == "cash"
|
||||
@cash = spay.payment_amount
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -18,4 +18,4 @@ class Origami::PayparPaymentsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,13 +14,15 @@ class Settings::MembershipActionsController < ApplicationController
|
||||
if !membership_actions_data.nil?
|
||||
url = params[:gateway_url].to_s + membership_actions_data.gateway_url.to_s
|
||||
puts url.to_json
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
if sale_data.customer_id
|
||||
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
||||
puts customer_data.to_json
|
||||
@membership_id = customer_data.membership_id
|
||||
@campaign_type_id =1
|
||||
if !@membership_id.nil?
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
puts membership_setting
|
||||
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id)
|
||||
if membership_data["status"]==true
|
||||
@membership_rebate_balance=membership_data["balance"]
|
||||
@@ -41,7 +43,7 @@ class Settings::MembershipActionsController < ApplicationController
|
||||
end
|
||||
render :json => @out.to_json
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
# GET /settings/membership_actions/1
|
||||
|
||||
Reference in New Issue
Block a user