api discount and change tax

This commit is contained in:
Thein Lin Kyaw
2023-10-17 16:52:12 +06:30
parent 81eb30c03a
commit 3441811bb0
27 changed files with 1225 additions and 1067 deletions

View File

@@ -23,9 +23,10 @@ class Api::CustomersController < Api::ApiController
def get_customer_by_account
account_no = params[:account_no]
group_type = params[:group_type] || 'food_court'
unless @customer = Customer.find_by(paypar_account_no: account_no)
response = Customer.search_paypar_account_no(account_no)
response = Customer.search_paypar_account_no(account_no)
if response["status"] == true
@customer = Customer.create({
name: response["customer_data"]["name"],
@@ -39,8 +40,10 @@ class Api::CustomersController < Api::ApiController
membership_id: response["customer_data"]["id"],
membership_type: response["customer_data"]["member_group_id"],
customer_type: "Dinein",
tax_profiles: ["1", "2"],
tax_profiles: TaxProfile.where(group_type: group_type).pluck(:id),
})
else
@message = response["message"]
end
end
end