order from app

This commit is contained in:
Myat Zin Wai Maw
2019-11-28 15:52:50 +06:30
parent fe5dc6bb5a
commit 09e7650452
8 changed files with 91 additions and 74 deletions

View File

@@ -1,5 +1,5 @@
class Api::PaymentsController < Api::ApiController
skip_before_action :authenticate
#Payment by Invoice ID
# Payment Method - [Cash | CreditNote | VISA | MASTER | etc..]
@@ -27,7 +27,9 @@ class Api::PaymentsController < Api::ApiController
if !sale.nil?
if sale.sale_status == "new"
if !params[:card_no].empty?
@status, @message = send_account_paymal(sale.grand_total, params[:card_no], sale.receipt_no)
current_shift = ShiftSale.current_shift(sale.shop_code)
current_login_employee =Employee.find(current_shift.employee_id)
@status, @message = send_account_paymal(sale.grand_total, params[:card_no], sale.receipt_no,current_login_employee)
if @status
sale_payment = SalePayment.new
status, @sale, @membership_data = sale_payment.process_payment(sale, current_login_employee, sale.grand_total, "paymal",params[:card_no])
@@ -67,15 +69,15 @@ class Api::PaymentsController < Api::ApiController
end
end
def send_account_paymal(amount, account_no, receipt_no)
def send_account_paymal(amount, account_no, receipt_no,current_login_employee)
sale = Sale.find_by_receipt_no(receipt_no)
@out = []
action_by = current_login_employee.name
@status = true
@message = ""
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
membership_setting = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",sale.shop_code)
if membership_setting.gateway_url
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
member_actions =MembershipAction.find_by_membership_type_and_shop_code("get_account_balance",sale.shop_code)
if member_actions.gateway_url
@campaign_type_id = nil
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s