Rebate Redeem add field

This commit is contained in:
Phyo
2017-06-23 18:45:15 +06:30
parent e01ecc6e0f
commit 05b4dbac7c

View File

@@ -94,10 +94,15 @@ class SalePayment < ApplicationRecord
sale_data = Sale.find_by_sale_id(sale_id) sale_data = Sale.find_by_sale_id(sale_id)
if sale_data if sale_data
others = 0
sale_data.sale_payments.each do |sale_payment|
others = others + sale_payment.payment_amount
end
redeem_prices = sale_data.grand_total -others
# Control for Paypar Cloud # Control for Paypar Cloud
begin 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,total_amount: redeem_prices,total_sale_transaction_amount: sale_data.grand_total,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'
@@ -292,7 +297,7 @@ class SalePayment < ApplicationRecord
# Control for Paypar Cloud # 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 ,total_sale_transaction_amount: sObj.grand_total,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,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',