fixed redeem
This commit is contained in:
@@ -142,7 +142,7 @@ class SaleAudit < ApplicationRecord
|
|||||||
if paymal[0]
|
if paymal[0]
|
||||||
remark = paymal[0].remark.split("}")
|
remark = paymal[0].remark.split("}")
|
||||||
response = "["+remark[0]+'}]'
|
response = "["+remark[0]+'}]'
|
||||||
response = JSON.parse(response)
|
# response = JSON.parse(response)
|
||||||
puts response
|
puts response
|
||||||
if response[0]["status"] == true
|
if response[0]["status"] == true
|
||||||
if response[0]["current_rebate_amount"].present?
|
if response[0]["current_rebate_amount"].present?
|
||||||
|
|||||||
@@ -233,9 +233,9 @@ class SalePayment < ApplicationRecord
|
|||||||
return response;
|
return response;
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
def redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
||||||
# membership_actions_data = MembershipAction.find_by_membership_type("redeem");
|
membership_actions_data = MembershipAction.find_by_membership_type("redeem");
|
||||||
membership_actions_data = PaymentMethodSetting.find_by_payment_method("Redeem")
|
# membership_actions_data = PaymentMethodSetting.find_by_payment_method("Redeem")
|
||||||
puts "This is membership_actions_data"
|
puts "This is membership_actions_data"
|
||||||
puts membership_actions_data.to_json
|
puts membership_actions_data.to_json
|
||||||
if !membership_actions_data.nil?
|
if !membership_actions_data.nil?
|
||||||
@@ -243,8 +243,9 @@ class SalePayment < ApplicationRecord
|
|||||||
url = paypar_url.to_s + membership_actions_data.gateway_url.to_s
|
url = paypar_url.to_s + membership_actions_data.gateway_url.to_s
|
||||||
merchant_uid = membership_actions_data.merchant_account_id
|
merchant_uid = membership_actions_data.merchant_account_id
|
||||||
auth_token = membership_actions_data.auth_token
|
auth_token = membership_actions_data.auth_token
|
||||||
campaign_type_id = JSON.parse(membership_actions_data.additional_parameters)["campaign_type_id"]
|
campaign_type_id = membership_actions_data.additional_parameters["campaign_type_id"]
|
||||||
sale_data = Sale.find_by_sale_id(sale_id)
|
sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
|
account_no = Customer.find_by_customer_id(self.sale.customer_id).paypar_account_no
|
||||||
|
|
||||||
if sale_data
|
if sale_data
|
||||||
others = 0
|
others = 0
|
||||||
@@ -261,7 +262,7 @@ class SalePayment < ApplicationRecord
|
|||||||
redeem_amount:received_amount,
|
redeem_amount:received_amount,
|
||||||
receipt_no:sale_data.receipt_no,
|
receipt_no:sale_data.receipt_no,
|
||||||
campaign_type_id:campaign_type_id,
|
campaign_type_id:campaign_type_id,
|
||||||
account_no:"",
|
account_no: account_no,
|
||||||
merchant_uid:merchant_uid,
|
merchant_uid:merchant_uid,
|
||||||
auth_token:auth_token}.to_json,
|
auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
@@ -504,7 +505,7 @@ class SalePayment < ApplicationRecord
|
|||||||
#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 = redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
|
||||||
|
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "#{membership_data} Redeem- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
|
remark = "#{membership_data} Redeem- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
|
||||||
|
|||||||
Reference in New Issue
Block a user