update dinga and paymal

This commit is contained in:
Aung Myo
2018-04-18 14:40:53 +06:30
parent de5bbb27f7
commit 5816a48d32
7 changed files with 64 additions and 44 deletions

View File

@@ -214,7 +214,7 @@ class SalePayment < ApplicationRecord
# Control for Paypar Cloud
begin
response = HTTParty.post(url,
:body => { membership_id:membership_id,
:body => { account_no:membership_id,
amount:received_amount,
receipt_no:sale_data.receipt_no,
merchant_uid:merchant_uid,
@@ -242,7 +242,7 @@ class SalePayment < ApplicationRecord
response =false;
end
Rails.logger.debug "Payment response"
Rails.logger.debug "Create Payment response"
Rails.logger.debug response.to_json
return response;
@@ -391,8 +391,13 @@ class SalePayment < ApplicationRecord
#Next time - validate if the vochure number is valid - within
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
account_no = self.payment_reference
if account_no == 0
account_no = customer_data.customer_id
end
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,account_no,self.received_amount,self.sale.sale_id)
#record an payment in sale-audit
remark = "#{membership_data} PayMal Payment- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
@@ -433,9 +438,17 @@ 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)
account_no = self.payment_reference
if account_no == 0
account_no = customer_data.customer_id
end
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,account_no,self.received_amount,self.sale.sale_id)
#record an payment in sale-audit
remark = "#{membership_data} Dinga Payment- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "