update membershp payment method

This commit is contained in:
Aung Myo
2018-09-13 18:03:48 +06:30
parent b1480a5066
commit 85fcd43ac2
5 changed files with 37 additions and 11 deletions

View File

@@ -72,6 +72,6 @@ class Settings::MembershipActionsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through. # Never trust parameters from the scary internet, only allow the white list through.
def settings_membership_action_params 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
end end

View File

@@ -41,6 +41,7 @@ class Settings::PaymentMethodSettingsController < ApplicationController
# PATCH/PUT /settings/payment_method_settings/1 # PATCH/PUT /settings/payment_method_settings/1
# PATCH/PUT /settings/payment_method_settings/1.json # PATCH/PUT /settings/payment_method_settings/1.json
def update def update
puts settings_payment_method_setting_params
respond_to do |format| respond_to do |format|
if @settings_payment_method_setting.update(settings_payment_method_setting_params) 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.' } format.html { redirect_to settings_payment_method_setting_path(@settings_payment_method_setting), notice: 'Payment method setting was successfully updated.' }

View File

@@ -1,4 +1,4 @@
class PaymentMethodSetting < ApplicationRecord class PaymentMethodSetting < ApplicationRecord
# validations # 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 end

View File

@@ -235,7 +235,7 @@ class SalePayment < ApplicationRecord
customer_data = Customer.find_by_customer_id(sale_data.customer_id) customer_data = Customer.find_by_customer_id(sale_data.customer_id)
if !membership_actions_data.nil? 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 merchant_uid = membership_actions_data.merchant_account_id
auth_token = membership_actions_data.auth_token auth_token = membership_actions_data.auth_token
@@ -261,7 +261,7 @@ class SalePayment < ApplicationRecord
auth_token:auth_token}.to_json auth_token:auth_token}.to_json
end end
puts params
# Control for Paypar Cloud # Control for Paypar Cloud
begin begin
response = HTTParty.post(url, response = HTTParty.post(url,

View File

@@ -9,15 +9,25 @@
<div class="form-inputs p-l-15"> <div class="form-inputs p-l-15">
<%= f.input :payment_method %> <%= f.input :payment_method %>
<%= f.input :is_active %> <%= f.input :is_active %>
<%= f.input :gateway_communication_type %> <!-- <div class="form-group gateway_communication_type bmd-form-group">
<%= f.input :gateway_url %> <%= f.label :gateway_communication_type, 'Gateway Communication Type'%>
<%= f.input :auth_token %> <select class="form-control col-md-12 gateway_type" name="gateway_communication_type" >
<%= f.input :merchant_account_id %> <option value="">Select Gateway Type</option>
<%= f.input :additional_parameters %> <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>
<div class="form-actions p-l-15"> <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> </div>
<% end %> <% end %>
</div> </div>
@@ -50,4 +60,19 @@
</div> </div>
</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>
-->