<commit_before>jQuery ($) ->
  # Payment model
  class Payment
    constructor: (id) ->
      @url  = Spree.url("#{Spree.routes.payments_api}/#{id}.json")
      @json = $.getJSON @url.toString(), (data) =>
        @data = data

    if_pending: (callback) ->
      @json.done (data) ->
        callback() if data.state is 'pending'

    update: (attributes, success) ->
      jqXHR = $.ajax
        type: 'PUT'
        url:  @url.toString()
        data: { payment: attributes }
      jqXHR.done (data) =>
        @data = data
      jqXHR.fail ->
        response = $.parseJSON(jqXHR.responseText)
        show_flash('error', response.error)

    amount:         -> @data.amount
    display_amount: -> @data.display_amount

  # Payment base view
  class PaymentView
    constructor: (@$el, @payment) ->
      @render()

    render: ->
      @add_action_button()

    show: -><commit_msg>Fixed a bug in payments js at backend<commit_after>jQuery ($) ->
  # Payment model
  class Payment
    constructor: (id) ->
      @url  = Spree.url("#{Spree.routes.payments_api}/#{id}.json" + '?token=' + Spree.api_key)
      @json = $.getJSON @url.toString(), (data) =>
        @data = data

    if_pending: (callback) ->
      @json.done (data) ->
        callback() if data.state is 'pending'

    update: (attributes, success) ->
      jqXHR = $.ajax
        type: 'PUT'
        url:  @url.toString()
        data: { payment: attributes }
      jqXHR.done (data) =>
        @data = data
      jqXHR.fail ->
        response = $.parseJSON(jqXHR.responseText)
        show_flash('error', response.error)

    amount:         -> @data.amount
    display_amount: -> @data.display_amount

  # Payment base view
  class PaymentView
    constructor: (@$el, @payment) ->
      @render()

    render: ->
      @add_action_button()

    show: ->
{'fraction_non_alphanumeric': 0.15405701754385964, 'fraction_numerical': 0.0, 'mean_word_length': 2.1739130434782608, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '5832276', 'n_tokens_mistral': 595, 'n_tokens_neox': 578, 'n_words': 131}