Merge branch 'r-1902001-01' of https://gitlab.com/code2lab/SXRestaurant into r-1902001-01

This commit is contained in:
Nweni
2019-12-13 13:58:36 +06:30

View File

@@ -158,6 +158,7 @@ class Crm::CustomersController < BaseCrmController
def edit
@customer = Customer.find(params[:id])
end
def sync
@customer = Customer.find(params[:id])
respond_to do |format|
@@ -169,31 +170,21 @@ class Crm::CustomersController < BaseCrmController
nrc = @customer.nrc_no
card_no = @customer.card_no
paypar_account_no = @customer.paypar_account_no
id = @crm_customer.membership_id
id = @customer.membership_id
member_group_id = @customer.membership_type
if !id.present? && !member_group_id.nil?
# if !id.present? && !member_group_id.nil?
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
member_group_id: member_group_id,
id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists
# if paypar_account_no != nil || paypar_account_no != ''
if paypar_account_no.present?
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no,
member_group_id: member_group_id,
id:id,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
end
begin
response = HTTParty.post(url,
@@ -247,7 +238,7 @@ class Crm::CustomersController < BaseCrmController
format.html { redirect_to crm_customers_path }
flash[:member_error] =response["message"]
end
end
# end
end
end
# POST /crm/customers
@@ -619,4 +610,3 @@ class Crm::CustomersController < BaseCrmController
end
end