add paymal payment

This commit is contained in:
phyusin
2018-03-30 16:53:38 +06:30
parent ac5987fbb5
commit fc8d8eea4a
6 changed files with 51 additions and 54 deletions

4
Gemfile Executable file → Normal file
View File

@@ -1,5 +1,5 @@
source 'https://rubygems.org'
ruby '2.4.0'
ruby '2.4.1'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
@@ -131,4 +131,4 @@ gem 'momentjs-rails' # for date-range selector
# gem 'bootstrap-datepicker-rails' # date picker
# gem 'jquery-datetimepicker-rails'
# gem 'select2-rails' # for multi-select and auto-complete select box
gem "chartkick" #chart lib
gem "chartkick" #chart lib

0
Gemfile.lock Executable file → Normal file
View File

View File

@@ -26,7 +26,7 @@ _MASTER_ = "/   MASTER PAYMENT";
_MPU_ = "/   MPU PAYMENT";
_ALIPAY_ = "/   Alipay";
_JUNCTIONPAY_ = "/   JunctionPay";
_PAYMAL_ = "/   Paymal";
_PAYMAL_ = "/   PAYMAL";
_OTHER_CHARGES_ = "/   CHARGES";
_OTHER_PAYMENTS_ = "/   OTHER PAYMENT";
_PAYMENTS_ = "/   PAYMENT";

View File

@@ -27,46 +27,46 @@ class Origami::PaymalController < BaseOrigamiController
@payment_prices = sale_data.grand_total - @payparcount -others
if sale_data
if sale_data.customer_id
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
if customer_data
@membership_id = customer_data.membership_id
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
@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
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"]
@out = true, @membership_rebate_balance,@membership_id
end
else
@out =false,0
end
else
@out = false,0
end
if sale_data
if sale_data.customer_id
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
if customer_data
@membership_id = customer_data.membership_id
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
@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
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"]
@out = true, @membership_rebate_balance,@membership_id
end
else
@out =false,0
end
else
@out = false,0
end
else
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end
@out = false, 0
else
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end
@out = false, 0
end
def create
cash = params[:payment_amount]

View File

@@ -49,15 +49,12 @@ class SalePayment < ApplicationRecord
payment_status = paypar_payment
when "foc"
payment_status = foc_payment
<<<<<<< HEAD
when "paymal"
payment_status = paymal_payment
=======
when "JunctionPay"
payment_status = junction_pay_payment
when "alipay"
payment_status = external_terminal_card_payment(:alipay)
>>>>>>> 996392a041cb5f92a3b2985cbd0379210132d829
else
puts "it was something else"
end
@@ -360,7 +357,6 @@ class SalePayment < ApplicationRecord
end
<<<<<<< HEAD
def paymal_payment
payment_status = false
@@ -386,7 +382,10 @@ class SalePayment < ApplicationRecord
else
sale_update_payment_status(0)
end
=======
return payment_status
end
def junction_pay_payment
payment_status = false
@@ -398,10 +397,7 @@ class SalePayment < ApplicationRecord
self.payment_status = "paid"
payment_method = self.save!
sale_update_payment_status(self.received_amount)
>>>>>>> 996392a041cb5f92a3b2985cbd0379210132d829
return payment_status
end
def sale_update_payment_status(paid_amount,check_foc = false)

View File

@@ -9,7 +9,6 @@
</span>
</ol>
</div> -->
<h5>PayMal Payment</h5>
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card m-l-10 m-t-10" style="padding:0px 20px;">
@@ -110,11 +109,13 @@
<script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() {
setHeaderBreadCrumb(_PAYMAL_);
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#paymentamt').attr("value",parseFloat("<%= @payment_prices %>") - parseFloat(localStorage.getItem("cash")));
}
});
else {
$('#paymentamt').attr("value",parseFloat("<%= @payment_prices %>") - parseFloat(localStorage.getItem("cash")));
}
});
$(document).on('click', '.cashier_number', function(event){
event.stopPropagation();
event.preventDefault();