Skip to content

Instantly share code, notes, and snippets.

Created October 21, 2013 09:54
Show Gist options
  • Save anonymous/7081401 to your computer and use it in GitHub Desktop.
Save anonymous/7081401 to your computer and use it in GitHub Desktop.
function responseCreditCallbackHandler(response) {
switch (response.status) {
case 201:
$.ajax({ url: '#{addcard_creditcards_path}',
type: 'POST',
beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', '#{form_authenticity_token}')},
dataType: "json",
data: { credit_uri: response.data.uri,
address: $('.cc-address').val(),
email: $('.cc-email').val(),
name: $('.cc-name').val(),
state: $('.cc-state').val(),
town: $('.cc-town').val(),
zip: $('.cc-zip').val(),
},
success: function(randomobject) {
window.location = '/products/' + randomobject.value + '/receipt';
}
});
break;
}
}
829962+00:00 app[web.1]: Started POST "/products/2/card" for 100.2.109.97 at 2013-10-21 09:13:03 +0000
835379+00:00 app[web.1]: WARNING: Can't verify CSRF token authenticity
834929+00:00 app[web.1]: Processing by CreditcardsController#addcard as HTML
834929+00:00 app[web.1]: Parameters: {"state"=>"NY", "id"=>"2"}
604099+00:00 heroku[router]: at=info method=POST path=/products/2/card host=app.herokuapp.com fwd="100.2.109.97" dyno=web.1 connect=1ms service=1781ms status=500 bytes=643
604259+00:00 app[web.1]:
602739+00:00 app[web.1]: Completed 500 Internal Server Error in 1768ms
604259+00:00 app[web.1]: Balanced::BadRequest (Balanced::BadRequest(400)::Bad Request:: POST https://api.balancedpayments.com/v1/customers: request: Invalid field [card_uri] - "None" must be a string URI Your request id is OHMfe86f2883a3011e3980d02a1fe53e539. ):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment