redeem process

This commit is contained in:
Moe Su
2017-06-09 02:40:35 +06:30
parent 7702c50675
commit c23f726cb3
2 changed files with 18 additions and 14 deletions

View File

@@ -79,17 +79,22 @@ class SalePayment < ApplicationRecord
end
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id,campaign_type_id)
url = paypar_url.to_s + "/api/redeem".to_s
response = HTTParty.post(url,
membership_actions_data = Settings::MembershipAction.find_by_membership_type("redeem_url");
if !membership_actions_data.nil?
url = paypar_url.to_s + membership_actions_data.gateway_url.to_s
campaign_type_id = 1
response = HTTParty.post(url,
:body => { generic_customer_id:membership_id,total_amount:received_amount,receipet_no:sale_id,campaign_type_id:campaign_type_id,account_no:""}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
)
puts "RRRRRRRR"
puts response.to_json
return response;
else
response =false;
end
return response;
end