app/assets/javascripts/charge_form.js.coffee.erb in supercharged-2.0.4 vs app/assets/javascripts/charge_form.js.coffee.erb in supercharged-2.1.0
- old
+ new
@@ -3,11 +3,11 @@
@form = $(selector)
return if @form.length == 0
@amount_input = @form.find("[role='charge-amount']")
@gateway_name_input = @form.find("[role='charge-gateway-name']")
- @id_input = if @form.find("[role='charge-id']").length then @form.find("[role='charge-id']") else @form.find("[value='<%= Supercharged::ChargesHelper::FAKE_ORDER_ID %>']")
+ @id_input = @form.find("[role='payment-form-order']")
@form.submit =>
valid = @startPayment()
unless valid
@@ -37,10 +37,10 @@
url: "/charges.json",
type: "POST",
async: false,
data: {charge: charge_attributes},
success: (response) ->
- options.success(response)
+ options.success(response.charge)
error: (jqXHR, status, errorThrown)=>
return unless jqXHR.status == 422
response = $.parseJSON(jqXHR.responseText)
options.validationError(response.errors)