diff --git a/app/controllers/api/verifications_controller.rb b/app/controllers/api/verifications_controller.rb index 1c2936fc..c65f24bc 100644 --- a/app/controllers/api/verifications_controller.rb +++ b/app/controllers/api/verifications_controller.rb @@ -4,10 +4,10 @@ class Api::VerificationsController < ActionController::API phone_number = params[:phone_number] #TODO - user generate - @cus = Customer.new - @cus.draft_customer(phone_number, rand(1000..9999)) + cus = Customer.new + @cus = cus.draft_customer(phone_number, rand(1000..9999)) if @cus.verify_status == false - # VerifyNumber.send_message(phone_number, @cus.pin_code) + VerifyNumber.send_message(phone_number, @cus.pin_code) @result = true end end diff --git a/app/controllers/origami/cash_ins_controller.rb b/app/controllers/origami/cash_ins_controller.rb index 030b56e1..8cbbef85 100755 --- a/app/controllers/origami/cash_ins_controller.rb +++ b/app/controllers/origami/cash_ins_controller.rb @@ -9,10 +9,11 @@ class Origami::CashInsController < BaseOrigamiController payment_method = params[:payment_method] payment_method_reference = params[:payment_method_reference] type = params[:type] + p_jour = PaymentJournal.new p_jour.cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user.id) + shift = ShiftSale.current_open_shift(current_user.id) - current_shift = ShiftSale.current_shift # set cashier @@ -20,19 +21,21 @@ class Origami::CashInsController < BaseOrigamiController shift = shift else open_cashier = Employee.where("role = 'cashier' AND token_session <> ''") - if open_cashier.count>0 + + if open_cashier.count > 0 shift = ShiftSale.current_open_shift(open_cashier[0].id) if shift shift = ShiftSale.current_open_shift(shift.id) - else + else shift = ShiftSale.current_open_shift(current_shift.id) - end - else - shift = Employee.find(current_shift.employee_id).name + end + else - end + shift = Employee.find(current_shift.employee_id).name + #shift = current_shift + end end shift.cash_in = shift.cash_in + amount.to_f diff --git a/app/models/customer.rb b/app/models/customer.rb index 5f0d7c7d..0795d59b 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -23,7 +23,7 @@ class Customer < ApplicationRecord self.name = "User " + pin.to_s self.contact_no = phone self.email = pin.to_s + "@gmail.com" - self.pin_code = pin + self.pin_code = pin.to_s self.pin_sent_at = Time.now self.save return self diff --git a/dump.rdb b/dump.rdb index 915067aa..5fcd8dc0 100644 Binary files a/dump.rdb and b/dump.rdb differ