customer update from doemal order
This commit is contained in:
@@ -14,12 +14,17 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
if status
|
if status
|
||||||
check_customer = Customer.find_by_email_and_membership_id_and_customer_type(params[:email],params[:membership_id],'Doemal')
|
if params[:customer_id] && !params[:customer_id].nil?
|
||||||
if !check_customer.nil?
|
customer = OrderReservation.addCustomer(params)
|
||||||
customer_id = check_customer.customer_id
|
customer_id = customer.id
|
||||||
else
|
else
|
||||||
customer = OrderReservation.addCustomer(params)
|
check_customer = Customer.find_by_email_and_membership_id_and_customer_type(params[:email],params[:membership_id],'Doemal')
|
||||||
customer_id = customer.id
|
if !check_customer.nil?
|
||||||
|
customer_id = check_customer.customer_id
|
||||||
|
else
|
||||||
|
customer = OrderReservation.addCustomer(params)
|
||||||
|
customer_id = customer.id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if !customer_id.nil?
|
if !customer_id.nil?
|
||||||
render :json => { :status => false, :message => "email and customer are already existed!" }
|
render :json => { :status => false, :message => "email and customer are already existed!" }
|
||||||
|
|||||||
@@ -22,7 +22,11 @@ class OrderReservation < ApplicationRecord
|
|||||||
else
|
else
|
||||||
gender = "Male"
|
gender = "Male"
|
||||||
end
|
end
|
||||||
customer = Customer.new
|
if params[:customer_id].nil?
|
||||||
|
customer = Customer.find(params[:customer_id])
|
||||||
|
else
|
||||||
|
customer = Customer.new
|
||||||
|
end
|
||||||
customer.name = params[:name]
|
customer.name = params[:name]
|
||||||
customer.email = params[:email]
|
customer.email = params[:email]
|
||||||
customer.contact_no = params[:contact_no] ? params[:contact_no] : ''
|
customer.contact_no = params[:contact_no] ? params[:contact_no] : ''
|
||||||
|
|||||||
Reference in New Issue
Block a user