Merge branch 'adminbsb_material_ui' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -35,12 +35,13 @@ class Origami::DingaController < BaseOrigamiController
|
||||
if !@membership_id.nil?
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
if membership_setting.gateway_url
|
||||
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
|
||||
if member_actions.gateway_url
|
||||
# payment_data =MembershipAction.find_by_membership_type("get_account_balance")
|
||||
payment_data = PaymentMethodSetting.find_by_payment_method("DINGA")
|
||||
if payment_data.gateway_url
|
||||
@campaign_type_id = nil
|
||||
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
|
||||
merchant_uid= member_actions.merchant_account_id
|
||||
auth_token = member_actions.auth_token.to_s
|
||||
url = membership_setting.gateway_url.to_s + payment_data.gateway_url.to_s
|
||||
merchant_uid= payment_data.merchant_account_id
|
||||
auth_token = payment_data.auth_token.to_s
|
||||
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
|
||||
if membership_data["status"]==true
|
||||
@membership_rebate_balance=membership_data["balance"]
|
||||
|
||||
@@ -37,12 +37,13 @@ class Origami::VoucherController < BaseOrigamiController
|
||||
membership_id = customer_data.membership_id
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
if membership_setting.gateway_url
|
||||
member_actions =MembershipAction.find_by_membership_type("get_account_balance") #need to modify here
|
||||
if member_actions.gateway_url
|
||||
campaign_type_id = member_actions.additional_parameter["campaign_type_id"]
|
||||
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
|
||||
merchant_uid= member_actions.merchant_account_id
|
||||
auth_token = member_actions.auth_token.to_s
|
||||
# payment_data =MembershipAction.find_by_membership_type("get_account_balance") #need to modify here
|
||||
payment_data = PaymentMethodSetting.find_by_payment_method("Voucher")
|
||||
if payment_data.gateway_url
|
||||
campaign_type_id = payment_data.additional_parameters["campaign_type_id"]
|
||||
url = membership_setting.gateway_url.to_s + payment_data.gateway_url.to_s
|
||||
merchant_uid= payment_data.merchant_account_id
|
||||
auth_token = payment_data.auth_token.to_s
|
||||
# membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
|
||||
# if membership_data["status"]==true
|
||||
# app_token: token,membership_id:membership_id,
|
||||
|
||||
@@ -72,6 +72,6 @@ class Settings::MembershipActionsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_membership_action_params
|
||||
params.require(:membership_action).permit(:membership_type, :is_active, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id, :created_by)
|
||||
params.require(:membership_action).permit(:membership_type, :is_active, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id, :created_by,:additional_parameters)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,6 +41,7 @@ class Settings::PaymentMethodSettingsController < ApplicationController
|
||||
# PATCH/PUT /settings/payment_method_settings/1
|
||||
# PATCH/PUT /settings/payment_method_settings/1.json
|
||||
def update
|
||||
puts settings_payment_method_setting_params
|
||||
respond_to do |format|
|
||||
if @settings_payment_method_setting.update(settings_payment_method_setting_params)
|
||||
format.html { redirect_to settings_payment_method_setting_path(@settings_payment_method_setting), notice: 'Payment method setting was successfully updated.' }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class PaymentMethodSetting < ApplicationRecord
|
||||
# validations
|
||||
validates_presence_of :payment_method #, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id
|
||||
validates_presence_of :payment_method , :gateway_communication_type #, :gateway_url, :auth_token, :merchant_account_id
|
||||
end
|
||||
|
||||
@@ -169,14 +169,15 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
||||
membership_actions_data = MembershipAction.find_by_membership_type("redeem");
|
||||
# membership_actions_data = MembershipAction.find_by_membership_type("redeem");
|
||||
membership_actions_data = PaymentMethodSetting.find_by_payment_method("Redeem")
|
||||
|
||||
if !membership_actions_data.nil?
|
||||
|
||||
url = paypar_url.to_s + membership_actions_data.gateway_url.to_s
|
||||
merchant_uid = membership_actions_data.merchant_account_id
|
||||
auth_token = membership_actions_data.auth_token
|
||||
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
|
||||
campaign_type_id = membership_actions_data.additional_parameters["campaign_type_id"]
|
||||
sale_data = Sale.find_by_sale_id(sale_id)
|
||||
|
||||
if sale_data
|
||||
@@ -227,16 +228,16 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.create_payment(paypar_url,token,membership_id,received_amount,sale_id)
|
||||
membership_actions_data = MembershipAction.find_by_membership_type("create_payment");
|
||||
def self.create_payment(paypar_url,payment_type,membership_id,received_amount,sale_id)
|
||||
# membership_actions_data = MembershipAction.find_by_membership_type("create_payment");
|
||||
membership_actions_data = PaymentMethodSetting.find_by_payment_method(payment_type)
|
||||
sale_data = Sale.find_by_sale_id(sale_id)
|
||||
customer_data = Customer.find_by_customer_id(sale_data.customer_id)
|
||||
if !membership_actions_data.nil?
|
||||
|
||||
url = paypar_url.to_s + membership_actions_data.gateway_url.to_s
|
||||
url = "paypar_url.to_s" + membership_actions_data.gateway_url.to_s
|
||||
merchant_uid = membership_actions_data.merchant_account_id
|
||||
auth_token = membership_actions_data.auth_token
|
||||
|
||||
|
||||
if sale_data
|
||||
others = 0
|
||||
@@ -260,7 +261,7 @@ class SalePayment < ApplicationRecord
|
||||
auth_token:auth_token}.to_json
|
||||
end
|
||||
|
||||
|
||||
puts params
|
||||
# Control for Paypar Cloud
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
@@ -457,7 +458,7 @@ class SalePayment < ApplicationRecord
|
||||
# account_no = customer_data.membership_id
|
||||
# end
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,account_no,self.received_amount,self.sale.sale_id)
|
||||
membership_data = SalePayment.create_payment(membership_setting.gateway_url,"PAYMAL",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} "
|
||||
@@ -507,7 +508,7 @@ class SalePayment < ApplicationRecord
|
||||
# end
|
||||
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,account_no,self.received_amount,self.sale.sale_id)
|
||||
membership_data = SalePayment.create_payment(membership_setting.gateway_url,"DINGA",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} "
|
||||
|
||||
@@ -359,6 +359,7 @@
|
||||
<tr>
|
||||
<td class="charges-name"><strong>
|
||||
<% if !@sale_taxes.empty? %>
|
||||
<input type="hidden" name="" id="check_tax" value="all">
|
||||
Tax:
|
||||
(<% @i = 0
|
||||
@sale_taxes.each do |ct| %>
|
||||
@@ -368,6 +369,7 @@
|
||||
<%end%>
|
||||
<%end %>)
|
||||
<% else %>
|
||||
<input type="hidden" name="" id="check_tax" value="">
|
||||
No Tax
|
||||
<% end %></strong><br>
|
||||
<%if !@webview && @changable_tax %>
|
||||
@@ -1104,8 +1106,8 @@
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
var sale_id = $("#sale_id").val(); //<%= @obj_sale.sale_id rescue "" %>
|
||||
var ajax_url = "/origami/sale/append_order";
|
||||
var tax_type = localStorage.getItem("tax_type");
|
||||
console.log(tax_type)
|
||||
// var tax_type = localStorage.getItem("tax_type");
|
||||
var tax_type = $("#check_tax").val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
|
||||
@@ -393,6 +393,7 @@
|
||||
<tr>
|
||||
<td class="charges-name"><strong>
|
||||
<% if !@sale_taxes.empty? %>
|
||||
<input type="hidden" name="" id="check_tax" value="all">
|
||||
Tax:
|
||||
(<% @i = 0
|
||||
@sale_taxes.each do |ct| %>
|
||||
@@ -402,6 +403,7 @@
|
||||
<%end%>
|
||||
<%end %>)
|
||||
<% else %>
|
||||
<input type="hidden" name="" id="check_tax" value="">
|
||||
No Tax
|
||||
<% end %></strong><br>
|
||||
<%if !@webview && @changable_tax %>
|
||||
@@ -1168,7 +1170,8 @@ $('#add_invoice').on('click',function(){
|
||||
var dining_id = "<%= @room.id %>"
|
||||
var sale_id = $("#sale_id").val(); //<%= @obj_sale.sale_id rescue "" %>
|
||||
var ajax_url = "/origami/sale/append_order";
|
||||
var tax_type = localStorage.getItem("tax_type");
|
||||
// var tax_type = localStorage.getItem("tax_type");
|
||||
var tax_type = $("#check_tax").val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
|
||||
@@ -9,15 +9,25 @@
|
||||
<div class="form-inputs p-l-15">
|
||||
<%= f.input :payment_method %>
|
||||
<%= f.input :is_active %>
|
||||
<%= f.input :gateway_communication_type %>
|
||||
<%= f.input :gateway_url %>
|
||||
<%= f.input :auth_token %>
|
||||
<%= f.input :merchant_account_id %>
|
||||
<%= f.input :additional_parameters %>
|
||||
<!-- <div class="form-group gateway_communication_type bmd-form-group">
|
||||
<%= f.label :gateway_communication_type, 'Gateway Communication Type'%>
|
||||
<select class="form-control col-md-12 gateway_type" name="gateway_communication_type" >
|
||||
<option value="">Select Gateway Type</option>
|
||||
<option value="Api">Api</option>
|
||||
<option value="Device">Device</option>
|
||||
<option value="Default">Default</option>
|
||||
</select>
|
||||
</div> -->
|
||||
<%= f.input :gateway_communication_type,:class=>'gateway_type', collection: [ "Api", "Default", "Device"] %>
|
||||
<%= f.input :gateway_url ,:class=>'gateway_type', :required => true %>
|
||||
<%= f.input :auth_token ,:class=>'auth_token', :required => true %>
|
||||
<%= f.input :merchant_account_id ,:class=>'merchant_id', :required => true%>
|
||||
<%= f.input :additional_parameters, as: :text %>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-actions p-l-15">
|
||||
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
|
||||
<%= f.submit "Submit",:class => 'btn btn-primary submitBtn btn-lg waves-effect' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -50,4 +60,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <script type="text/javascript">
|
||||
$(function() {
|
||||
$(document).on('click', '#payment_method_setting_gateway_communication_type', function(event){
|
||||
if ($(this).val() == "Api") {
|
||||
$('.submitBtn').attr("disabled", true);
|
||||
}else{
|
||||
$('.submitBtn').removeAttr("disabled");
|
||||
}
|
||||
});
|
||||
$( "#payment_method_setting_gateway_url" ).keypress(function() {
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
-->
|
||||
Reference in New Issue
Block a user