Rebate add
This commit is contained in:
@@ -217,7 +217,7 @@ class SalePayment < ApplicationRecord
|
|||||||
self.sale.sale_status = "completed"
|
self.sale.sale_status = "completed"
|
||||||
self.sale.save!
|
self.sale.save!
|
||||||
table_update_status(sObj)
|
table_update_status(sObj)
|
||||||
rebat()
|
rebat(sObj)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -233,8 +233,25 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def rebat
|
def rebat(sObj)
|
||||||
|
food_prices, beverage_prices = SaleItem.calculate_food_beverage(sObj.sale_items)
|
||||||
|
generic_customer_id = sObj.customer.membership_id
|
||||||
|
total_amount = sObj.total_amount
|
||||||
|
receipt_no = sObj.receipt_no
|
||||||
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
|
memberaction = MembershipAction.find_by_membership_type("rebate")
|
||||||
|
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
||||||
|
app_token = membership.auth_token.to_s
|
||||||
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
puts url
|
||||||
|
response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,total_amount: total_amount,campaign_type_id: campaign_type_id,
|
||||||
|
receipt_no: receipt_no}.to_json,
|
||||||
|
:headers => {
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
})
|
||||||
|
|
||||||
|
puts response.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
Reference in New Issue
Block a user