<commit_before>require 'capybara'
require 'capybara/poltergeist'

class OrderLunchService
  include Capybara::DSL

  attr_accessor :crawler, :result

  def initialize
    @crawler = set_up_crawler
    @result = false
  end

  def call
    go_to_gcct
    fill_order_item
    fill_contact_info
    skip_captcha
    submit_order
    sleep(1)
    check_status
    close_crawler
    result
  end

  private

  def go_to_gcct
    crawler.visit("http://giachanhcamtuyet.com.vn/index.php?m=dat-tiec&id=12&t=orders&s=1")
  end

  def fill_order_item
    Order.today.first.order_items.each do |item|
      item_element = crawler.all(".name", text: item.dish.name)[0]
      parent = item_element.find(:xpath, '..')
      assign_quantity_item(parent)
      select_item(parent)
    end
  end

  def fill_contact_info
    crawler.find("#fullname").set("<NAME>")
    crawler.find("#address").set("25 Nguyễn Hữu Cầu, P. Cầu Kho, Q.1")
    crawler.find("#tel").set("017893561332")
    crawler.find("#email").set("<EMAIL>")
  end

  def skip_captcha<commit_msg>Update real contact<commit_after>require 'capybara'
require 'capybara/poltergeist'

class OrderLunchService
  include Capybara::DSL

  attr_accessor :crawler, :result

  def initialize
    @crawler = set_up_crawler
    @result = false
  end

  def call
    go_to_gcct
    fill_order_item
    fill_contact_info
    skip_captcha
    submit_order
    sleep(1)
    check_status
    close_crawler
    result
  end

  private

  def go_to_gcct
    crawler.visit("http://giachanhcamtuyet.com.vn/index.php?m=dat-tiec&id=12&t=orders&s=1")
  end

  def fill_order_item
    Order.today.first.order_items.each do |item|
      item_element = crawler.all(".name", text: item.dish.name)[0]
      parent = item_element.find(:xpath, '..')
      assign_quantity_item(parent)
      select_item(parent)
    end
  end

  def fill_contact_info
    crawler.find("#fullname").set("<NAME>")
    crawler.find("#address").set("93bis Nguyễn Văn Thủ, P. Đa Kao, Q.1")
    crawler.find("#tel").set("0986088803")
    crawler.find("#email").set("<EMAIL>")
  end

  def skip_captcha
{'fraction_non_alphanumeric': 0.11950286806883365, 'fraction_numerical': 0.018164435946462717, 'mean_word_length': 3.462686567164179, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3085897', 'n_tokens_mistral': 831, 'n_tokens_neox': 801, 'n_words': 133}