app/assets/javascripts/spree/backend/payments/edit.js.coffee in spree_backend-2.3.13 vs app/assets/javascripts/spree/backend/payments/edit.js.coffee in spree_backend-2.4.0.rc1
- old
+ new
@@ -1,17 +1,17 @@
jQuery ($) ->
# Payment model
order_id = $('#payments').data('order-id')
class Payment
constructor: (id) ->
- @url = Spree.url("#{Spree.routes.payments_api(order_id)}/#{id}.json" + '?token=' + Spree.api_key)
+ @url = Spree.url("#{Spree.routes.payments_api(order_id)}/#{id}.json")
@json = $.getJSON @url.toString(), (data) =>
@data = data
- if_editable: (callback) ->
+ if_pending: (callback) ->
@json.done (data) ->
- callback() if data.state in ['checkout', 'pending']
+ callback() if data.state is 'pending'
update: (attributes, success) ->
jqXHR = $.ajax
type: 'PUT'
url: @url.toString()
@@ -140,10 +140,10 @@
@normalize_amount: (amount) ->
separator = Spree.translations.currency_separator
amount.replace(///[^\d#{separator}]///g, '')
- # Attach ShowPaymentView to each editable payment in the table
+ # Attach ShowPaymentView to each pending payment in the table
$('.admin tr[data-hook=payments_row]').each ->
$el = $(@)
payment = new Payment($el.prop('id').match(/\d+$/))
- payment.if_editable -> new ShowPaymentView($el, payment)
+ payment.if_pending -> new ShowPaymentView($el, payment)