update rebate and update api
This commit is contained in:
@@ -137,7 +137,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
:body => member_params,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
@@ -260,7 +260,7 @@ end
|
||||
:body => member_params,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
@@ -317,7 +317,7 @@ end
|
||||
:body => member_params,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
|
||||
@@ -199,7 +199,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
}, :timeout => 10)
|
||||
rescue HTTParty::Error
|
||||
response = {"status": false, "message": "Can't open membership server " }
|
||||
@@ -215,7 +215,8 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
else
|
||||
response = {"status": false, "message": "You have no selected discount item" }
|
||||
end
|
||||
|
||||
puts "discount"
|
||||
puts response.to_json
|
||||
# Re-calc All Amount in Sale
|
||||
if response["status"] == true
|
||||
discount_amount = response["discount_earned"]
|
||||
@@ -229,7 +230,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
else
|
||||
result = {:status=> response["message"],:title=>"Alert", :table_id => table_id,:table_type => table_type }
|
||||
end
|
||||
|
||||
|
||||
render :json => result.to_json
|
||||
|
||||
end #end Is Card Payment
|
||||
|
||||
@@ -81,7 +81,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
if customer.membership_id != nil && rebate
|
||||
member_info = Customer.get_member_account(customer)
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
end
|
||||
|
||||
@@ -127,8 +127,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
# get member information
|
||||
if @customer.membership_id != nil && rebate
|
||||
response = Customer.get_member_account(@customer)
|
||||
puts response.to_json
|
||||
if response["status"]==true
|
||||
response["data"].each do |res|
|
||||
response["account_data"].each do |res|
|
||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||
@balance += res["balance"]
|
||||
# @accountable_type = res["accountable_type"]
|
||||
|
||||
@@ -45,7 +45,7 @@ class Origami::VoucherController < BaseOrigamiController
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
}, :timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
|
||||
@@ -23,13 +23,17 @@ class Customer < ApplicationRecord
|
||||
# urltest =self.url_exist?(url)
|
||||
|
||||
begin
|
||||
response = HTTParty.get(url, :body => { membership_id: customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
response = HTTParty.get(url, :body => {
|
||||
membership_id: customer.membership_id,
|
||||
merchant_uid:merchant_uid,
|
||||
type: "summary",
|
||||
auth_token:auth_token
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=2'
|
||||
},
|
||||
:timeout => 10)
|
||||
rescue HTTParty::Error
|
||||
response = {status: false, message: "Server Error"}
|
||||
|
||||
@@ -63,7 +67,7 @@ class Customer < ApplicationRecord
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
@@ -116,7 +120,7 @@ class Customer < ApplicationRecord
|
||||
:body => member_params,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
})
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false, message: "Server Time out" }
|
||||
@@ -183,7 +187,7 @@ class Customer < ApplicationRecord
|
||||
receipt_no: receipt_no,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
}, :timeout => 10)
|
||||
rescue Net::OpenTimeout
|
||||
response = { "status": false , "message": "Connect To" }
|
||||
@@ -215,7 +219,7 @@ class Customer < ApplicationRecord
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
|
||||
@@ -85,7 +85,7 @@ class SalePayment < ApplicationRecord
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
}, :timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
@@ -120,17 +120,18 @@ class SalePayment < ApplicationRecord
|
||||
# Control for Paypar Cloud
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
:body => { generic_customer_id:membership_id,
|
||||
:body => { membership_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,
|
||||
account_no:"",
|
||||
merchant_uid:merchant_uid,
|
||||
auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
@@ -399,7 +400,7 @@ class SalePayment < ApplicationRecord
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
}, :timeout => 10)
|
||||
rescue Net::OpenTimeout
|
||||
response = { "status": false , "message": "Connect To" }
|
||||
@@ -468,7 +469,7 @@ class SalePayment < ApplicationRecord
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
'Accept' => 'application/json; version=2'
|
||||
}, :timeout => 10)
|
||||
rescue Net::OpenTimeout
|
||||
response = { "status": false , "message": "Connect To" }
|
||||
|
||||
@@ -295,14 +295,14 @@ class ReceiptBillPdf < Prawn::Document
|
||||
total = total + res["balance"]
|
||||
#total redeem amount
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
|
||||
redeem = redeem + res["redeem"]
|
||||
redeem = redeem + res["withdraw"]
|
||||
balance = balance + res["balance"]
|
||||
end
|
||||
#end Total redem
|
||||
#total Rebate Earn
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateAccount" && res["status"]== "Rebate"
|
||||
|
||||
rebate_balance = rebate_balance + res["rebate"]
|
||||
rebate_balance = rebate_balance + res["deposit"]
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
@@ -310,20 +310,20 @@ class ReceiptBillPdf < Prawn::Document
|
||||
text "Rebate Earn", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["rebate"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
# Total Rebate Amount if birthday
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateBonusAccount" && res["status"]== "Rebate"
|
||||
rebate_balance = rebate_balance + res["rebate"]
|
||||
rebate_balance = rebate_balance + res["deposit"]
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Rebate Earn Bonus", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["rebate"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
#end Total rebate if birthday
|
||||
|
||||
@@ -251,4 +251,4 @@ zone_queue_station1 = OrderQueueProcessByZone.create({order_queue_station: order
|
||||
zone_queue_station2 = OrderQueueProcessByZone.create({order_queue_station: order_queue_station2, zone: zone2})
|
||||
zone_queue_station3 = OrderQueueProcessByZone.create({order_queue_station: zone_order_queue_station, zone: zone3})
|
||||
|
||||
puts " Finished System Default Set Up Data "
|
||||
puts " Finished System Default Set Up Data vWSsseoZCzxd6xcNf_uS RxzaYyAGzm7VqAZ4hKnv "
|
||||
|
||||
Reference in New Issue
Block a user