<commit_before>class AlipayTradePagePaysController < ApplicationController
  skip_before_action :verify_authenticity_token, only: [:notify]

  def show
  end

  def create
    redirect_to $alipay.page_execute_url(
      method: 'alipay.trade.page.pay',
      biz_content: JSON.generate({
        out_trade_no: Time.now.to_s(:number),
        product_code: 'FAST_INSTANT_TRADE_PAY',
        total_amount: '0.01',
        subject: 'Test Payment 中文'
      }, ascii_only: true),
      return_url: done_alipay_trade_page_pay_url,
      notify_url: notify_alipay_trade_page_pay_url
    )
  end

  def done
    @verify = $alipay.verify?(request.query_parameters)
  end

  def notify
    if $alipay.verify?(request.request_parameters)
      logger.info 'Verify success'
      render plain: 'success'
    else
      logger.info 'Verify fail'
      render plain: 'fail'
    end<commit_msg>use uuid for test trade no<commit_after>class AlipayTradePagePaysController < ApplicationController
  skip_before_action :verify_authenticity_token, only: [:notify]

  def show
  end

  def create
    redirect_to $alipay.page_execute_url(
      method: 'alipay.trade.page.pay',
      biz_content: JSON.generate({
        out_trade_no: SecureRandom.uuid,
        product_code: 'FAST_INSTANT_TRADE_PAY',
        total_amount: '0.01',
        subject: 'Test Payment 中文'
      }, ascii_only: true),
      return_url: done_alipay_trade_page_pay_url,
      notify_url: notify_alipay_trade_page_pay_url
    )
  end

  def done
    @verify = $alipay.verify?(request.query_parameters)
  end

  def notify
    if $alipay.verify?(request.request_parameters)
      logger.info 'Verify success'
      render plain: 'success'
    else
      logger.info 'Verify fail'
      render plain: 'fail'
    end
{'fraction_non_alphanumeric': 0.08607021517553794, 'fraction_numerical': 0.0033975084937712344, 'mean_word_length': 3.257831325301205, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4435911', 'n_tokens_mistral': 612, 'n_tokens_neox': 595, 'n_words': 120}