akkdio / sales Goto Github PK
View Code? Open in Web Editor NEWjust trying the api for stripe out
just trying the api for stripe out
The test on page 30 does not work for me. I get this error:
ActionController::UrlGenerationError: No route matches {:email=>"[email protected]", :stripeToken=>"tok_123456", :controller=>"payments", :action=>"create"}
Looking at the rails guides I find that the source of the error may be an id is not being set:
when "/missing_keys"
raise ActionController::UrlGenerationError, "No route matches"
however, I tried a variety of ways to isolate this to find the keys that were missing but am lost. So I will punt for now.
The js should read like this:
<script type="text/javascript">
$(function(){
Stripe.setPublishableKey('<%=Rails.configuration.stripe[:publishable_key]%>');
});
$('#payment-form').submit(function(event) {
var form = $(this);
form.find('button').prop('disabled', true);
Stripe.createToken(form, stripeResponseHandler);
return false;
});
</script>
The book has $(function({... which leaves out a ")"
Trying the AASM gem from the book on page 57 and having issues getting the charge_card method to fire. This is my initial thought since the errors coming back (see below) are saying complaining about not having and attribute. I have not been through the code line by line with a fine tooth comb to see if there is typo somewhere but I have commented out the attribute calls in the sales create method and it seems that the call to stripe.charge is not happening. Here is the error with this :
ActiveRecord::UnknownAttributeError in PaymentsController#create
unknown attribute: amount
Incidently the app lives on heroku:
https://morning-earth-2357.herokuapp.com
But it has these issues and more since I am not strictly adhering to the book. Partly because the book has errors and partly because it lacks a complete code list and is only given in snippets and that is bad news bears for the noobs.
This route here:
get '/pickup/:guid', to: 'transactions#show', as: :pickup
should be:
get '/pickup/:guid', to: 'transactions#pickup', as: :pickup
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.