diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 0350049c..2df76af8 100644 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -29,7 +29,9 @@ class OrderQueueStation < ApplicationRecord if oqs.id == oqpbz.order_queue_station_id #Same Order_items can appear in two location. 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 diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 3b67648c..856cd054 100644 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -66,19 +66,20 @@ class SalePayment < ApplicationRecord end - def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token) - begin - 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, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json' - }, :timeout => 10 - ) - rescue Net::OpenTimeout - response = { status: false } - end - return response; + def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token) + # Control for Paypar Cloud + begin + 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, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, :timeout => 10 + ) + rescue Net::OpenTimeout + response = { status: false } + end + return response; end 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"] sale_data = Sale.find_by_sale_id(sale_id) if sale_data - 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, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json' - } - ) + # Control for Paypar Cloud + begin + 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, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, + :timeout => 10 + ) + rescue Net::OpenTimeout + response = false + end else response = false; end @@ -122,7 +129,6 @@ class SalePayment < ApplicationRecord end def creditnote_payment(customer_id) - payment_status = false self.payment_method = "creditnote" @@ -190,7 +196,6 @@ class SalePayment < ApplicationRecord payment_status = false #Next time - validate if the vochure number is valid - within - customer_data = Customer.find_by_customer_id(self.sale.customer_id) 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) @@ -269,6 +274,7 @@ class SalePayment < ApplicationRecord auth_token = memberaction.auth_token.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s + # Control for Paypar Cloud 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, receipt_no: receipt_no,auth_token:auth_token}.to_json,