foodcourt apis for app

This commit is contained in:
Thein Lin Kyaw
2022-07-08 16:06:12 +06:30
parent 7485486868
commit 063345eae3
37 changed files with 785 additions and 171 deletions

View File

@@ -21,6 +21,30 @@ class Api::CustomersController < Api::ApiController
render json: status
end
def get_customer_by_account
account_no = params[:account_no]
unless @customer = Customer.find_by(paypar_account_no: account_no);
response = Customer.search_paypar_account_no(filter)
if response["status"] == true
@customer = Customer.create({
name: response["customer_data"]["name"],
contact_no: response["customer_data"]["phone"],
email: response["customer_data"]["email"],
date_of_birth: response["customer_data"]["DOB"],
nrc_no: response["customer_data"]["NRC"],
address: response["customer_data"]["address"],
card_no: response["customer_data"]["customer_card_no"],
paypar_account_no: account_no,
membership_id: response["customer_data"]["id"],
membership_type: response["customer_data"]["member_group_id"],
customer_type: "Dinein",
tax_profiles: ["1", "2"],
})
end
end
end
def get_customer_by_phone
if @customer = Customer.find_by_contact_no(params[:contact_no])
status = true