This commit is contained in:
yarzar_code
2020-01-12 20:07:28 +06:30
parent 314cc507a3
commit dff2c69627
89 changed files with 492 additions and 469 deletions

View File

@@ -36,7 +36,7 @@ class SalePayment < ApplicationRecord
def self.get_kbz_pay_amount(sale_id, current_user,shop)
amount = 0
kbz_pay_method = PaymentMethodSetting.where(:payment_method => KbzPay::KBZ_PAY,:shop_code => shop.shop_code).last
kbz_pay_method = PaymentMethodSetting.where(:payment_method => KbzPay::KBZ_PAY).last
sale_payment = SalePayment.where('sale_id=? and payment_method=? and payment_status!=?', sale_id, KbzPay::KBZ_PAY, 'dead').last
if !sale_payment.nil? and !kbz_pay_method.nil?
if sale_payment.payment_status == 'pending'
@@ -295,7 +295,7 @@ class SalePayment < ApplicationRecord
def self.create_payment(paypar_url,payment_type,membership_id,received_amount,sale_id)
# membership_actions_data = MembershipAction.find_by_membership_type("create_payment");
sale_data = Sale.find_by_sale_id(sale_id)
membership_actions_data = PaymentMethodSetting.find_by_payment_method_and_shop_code(payment_type,sale_data.shop_code)
membership_actions_data = PaymentMethodSetting.find_by_payment_method(payment_type)
customer_data = Customer.find_by_customer_id(sale_data.customer_id)
if !membership_actions_data.nil?
@@ -530,7 +530,7 @@ class SalePayment < ApplicationRecord
#Next time - validate if the vochure number is valid - within
account_no = self.payment_reference
# self.sale.customer.update_attributes(paypar_account_no: )
membership_setting = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",self.sale.shop_code)
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
membership_data = SalePayment.create_payment(membership_setting.gateway_url,"PAYMAL",account_no,self.received_amount,self.sale.sale_id)
#record an payment in sale-audit
@@ -783,8 +783,8 @@ class SalePayment < ApplicationRecord
overall_dis = sObj.total_discount
if credit != 1
membership = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",sObj.shop_code)
memberaction = MembershipAction.find_by_membership_type_and_shop_code("get_member_campaign",sObj.shop_code)
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("get_member_campaign")
merchant_uid = memberaction.merchant_account_id.to_s
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
auth_token = memberaction.auth_token.to_s
@@ -868,8 +868,8 @@ class SalePayment < ApplicationRecord
if total_amount >= 0
receipt_no = sObj.receipt_no
membership = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",sObj.shop_code)
memberaction = MembershipAction.find_by_membership_type_and_shop_code("rebate",sObj.shop_code)
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("rebate")
merchant_uid = memberaction.merchant_account_id.to_s
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
auth_token = memberaction.auth_token.to_s