customer create
This commit is contained in:
26
app/controllers/api/verifications_controller.rb
Normal file
26
app/controllers/api/verifications_controller.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
class Api::VerificationsController < ActionController::API
|
||||
|
||||
def new
|
||||
phone_number = params[:phone_number]
|
||||
|
||||
#TODO - user generate
|
||||
@cus = Customer.new
|
||||
@cus.draft_customer(phone_number, rand(1000..9999))
|
||||
if @cus.verify_status == false
|
||||
# VerifyNumber.send_message(phone_number, @cus.pin_code)
|
||||
@result = true
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
phone_number = params[:phone_number]
|
||||
pin_code = params[:pin_code]
|
||||
@cus = Customer.find_by_contact_no(phone_number)
|
||||
if !@cus.nil? && @cus.pin_code.to_i == pin_code.to_i
|
||||
@cus.verify_status = true
|
||||
@cus.save
|
||||
@result = true
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user