control paypar url and oqs fix
This commit is contained in:
@@ -29,7 +29,9 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
if oqs.id == oqpbz.order_queue_station_id
|
if oqs.id == oqpbz.order_queue_station_id
|
||||||
#Same Order_items can appear in two location.
|
#Same Order_items can appear in two location.
|
||||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||||
end
|
else
|
||||||
|
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -66,19 +66,20 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token)
|
def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token)
|
||||||
begin
|
# Control for Paypar Cloud
|
||||||
response = HTTParty.get(url,
|
begin
|
||||||
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
response = HTTParty.get(url,
|
||||||
:headers => {
|
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
'Content-Type' => 'application/json',
|
:headers => {
|
||||||
'Accept' => 'application/json'
|
'Content-Type' => 'application/json',
|
||||||
}, :timeout => 10
|
'Accept' => 'application/json'
|
||||||
)
|
}, :timeout => 10
|
||||||
rescue Net::OpenTimeout
|
)
|
||||||
response = { status: false }
|
rescue Net::OpenTimeout
|
||||||
end
|
response = { status: false }
|
||||||
return response;
|
end
|
||||||
|
return response;
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
||||||
@@ -90,13 +91,19 @@ class SalePayment < ApplicationRecord
|
|||||||
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
|
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
|
||||||
sale_data = Sale.find_by_sale_id(sale_id)
|
sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
if sale_data
|
if sale_data
|
||||||
response = HTTParty.post(url,
|
# Control for Paypar Cloud
|
||||||
:body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
begin
|
||||||
:headers => {
|
response = HTTParty.post(url,
|
||||||
'Content-Type' => 'application/json',
|
:body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
'Accept' => 'application/json'
|
:headers => {
|
||||||
}
|
'Content-Type' => 'application/json',
|
||||||
)
|
'Accept' => 'application/json'
|
||||||
|
},
|
||||||
|
:timeout => 10
|
||||||
|
)
|
||||||
|
rescue Net::OpenTimeout
|
||||||
|
response = false
|
||||||
|
end
|
||||||
else
|
else
|
||||||
response = false;
|
response = false;
|
||||||
end
|
end
|
||||||
@@ -122,7 +129,6 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def creditnote_payment(customer_id)
|
def creditnote_payment(customer_id)
|
||||||
|
|
||||||
payment_status = false
|
payment_status = false
|
||||||
|
|
||||||
self.payment_method = "creditnote"
|
self.payment_method = "creditnote"
|
||||||
@@ -190,7 +196,6 @@ class SalePayment < ApplicationRecord
|
|||||||
payment_status = false
|
payment_status = false
|
||||||
|
|
||||||
#Next time - validate if the vochure number is valid - within
|
#Next time - validate if the vochure number is valid - within
|
||||||
|
|
||||||
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
|
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
|
||||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
|
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
|
||||||
@@ -269,6 +274,7 @@ class SalePayment < ApplicationRecord
|
|||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
|
||||||
|
# Control for Paypar Cloud
|
||||||
begin
|
begin
|
||||||
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id,
|
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id,
|
||||||
receipt_no: receipt_no,auth_token:auth_token}.to_json,
|
receipt_no: receipt_no,auth_token:auth_token}.to_json,
|
||||||
|
|||||||
Reference in New Issue
Block a user