control paypar url and oqs fix

This commit is contained in:
Yan
2017-06-19 11:56:26 +06:30
parent 566cc2f3c1
commit dd3c429301
2 changed files with 31 additions and 23 deletions

View File

@@ -29,6 +29,8 @@ 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)
else
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
end end
end end
end end

View File

@@ -67,6 +67,7 @@ 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)
# Control for Paypar Cloud
begin begin
response = HTTParty.get(url, response = HTTParty.get(url,
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, :body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
@@ -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
# Control for Paypar Cloud
begin
response = HTTParty.post(url, response = HTTParty.post(url,
: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, :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,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => '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,