Modern Perlcommerce Past and Future API Development & Deployment
Total Page:16
File Type:pdf, Size:1020Kb
Modern PerlCommerce Past and Future API Development & Deployment Modern PerlCommerce Stefan Hornburg (Racke) [email protected] Pittsburgh Perl Workshop, 8th October 2011 racke Modern PerlCommerce Modern PerlCommerce Perl Buzzwords Past and Future Modern Perl API PerlCommerce Choices Development & Deployment Nitesi racke Modern PerlCommerce Modern PerlCommerce Perl Buzzwords Past and Future Modern Perl API PerlCommerce Choices Development & Deployment Perl Buzzwords I Marketing Perl I Modern Perl I Postmodern Perl racke Modern PerlCommerce Modern PerlCommerce Perl Buzzwords Past and Future Modern Perl API PerlCommerce Choices Development & Deployment Modern Perl I CPAN I Best Practices I Tests I Separation (Modules, Plugins, Hooks, Templates) I PSGI/Plack racke Modern PerlCommerce Modern PerlCommerce Perl Buzzwords Past and Future Modern Perl API PerlCommerce Choices Development & Deployment PerlCommerce Choices I Interchange I Handel I Agora I Business::Cart::Generic racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Past I 1995 CGI I 1995 MiniVend I 1998 http://www.materialboerse.de/ I 2001 Interchange racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Interchange Development I Lot of things I Small community I Same codebase racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Status quo racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment References I Backcountry http://www.backcountry.com/ I FragnanceNet http://www.fragrancenet.com/ racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Future racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Principles I KISS I Components I Agnostic I Expressive racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Agnostic Cart I Session I DBI I Webservice * racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Agnostic Account Manager I DBI I LDAP * I OpenID * racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Agnostic Templating Engine I Template::Toolkit I Template::Flute racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Agnostic Web framework I Catalyst I Mojo I Dancer racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Preferences I Dancer I Template::Flute I DBI racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Framework I Dispatching requests I Parameter parsing I Session handling I Template engine I I18N racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Extensions I Bundles I Plugins I Hooks racke Modern PerlCommerce Modern PerlCommerce Past and Future Past API Future Development & Deployment Features I Navigation I Cart I Checkout I Accounts racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Cart I SKU, Name, Quantity, Price I Price > 0 I Combines automatically I Multiple carts I Storage everywhere I Price caching racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Nitesi::Cart Methods use Dancer:: Plugin :: Nitesi; cart −>add(sku => ’POM253’ , name => ’Pomelo’ , price => 3.00, quantity => 10); cart −>remove(sku => ’POM253’ ); cart −>count ( ) ; cart −>c l e a r ( ) ; cart −>t o t a l ( ) ; cart −>subtotal (); racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Everything is a Cart I Saved Carts I Wishlists I Collections racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Multiple Carts cart( ’wishlist ’)−>add(sku => ’ORA322’ , name => ’Orange’ , price => 2.00, quantity => 5); racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Cart Backends I Session I DBI racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Inventory Check MinQuantityField min_quantity MaxQuantityField inventory:quantity racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Inventory Check Hook hook ’before_cart_add ’ => sub { my ($cart, $item) = @_; my ($inventory ); $inventory = query−>select_field(table => ’products’, field => ’inventory’, where => {sku => $item −>{sku } } ) ; i f ( $item −>{quantity} > $inventory) { $item −>{error} = ’Out of stock’; } }; racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Cart Hooks I before_cart_add I after_cart_add racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Cart Hooks I before_cart_remove I after_cart_remove racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Checkout I Taxes I Shipping I Payment I Invoice racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Payment I Business::OnlinePayment racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Tax Modules on CPAN I Business::Tax::Canada I Business::CA::GST I Business::Tax::VAT I Business::Tax::VAT::Validation racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Shipping I Simple Shipping I Crazy Shipping I Shipping API racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Costs $cart −>apply_cost(amount => 5); $cart −>apply_cost(amount => 0.19, relative => 1); racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms PDF Invoices I HTML template I Template::Flute::PDF racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Accounts post ’/login’ => sub { i f ( account−>login(username => params( ’body ’)−>{username} , password => params( ’body ’)−>{password})) { redirect ’/customerservice ’; } else { redirect ’/login’; } }; racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Accounts get ’/checkout’ => sub { i f ( account−>acl(check => ’submit_orders’)) { return template ’checkout ’; } redirect ’/access_denied’; }; racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Account manager I Account Providers I Login/Logout I Account Information I Login status I Forgot password I Registration racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Account Provider I DBI I LDAP * I Htpasswd * I OpenID * I OAuth * racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Access Control I User I Roles I Permissions racke Modern PerlCommerce Modern PerlCommerce Cart Past and Future Checkout API Accounts and Access Control Development & Deployment Forms Forms I Display I Validation I Storage racke Modern PerlCommerce Modern PerlCommerce Dancer Past and Future Contribution API The End Development & Deployment Routes I Categories I Products I Cart I Checkout I Login/Logout I Customer Service racke Modern PerlCommerce Modern PerlCommerce Dancer Past and Future Contribution API The End Development & Deployment Default Route get qr { / ( . ∗ ) } => sub { my ($sku) = splat; my $product ; # check for existing product i f ($product = database−>quick_select( ’products’, {sku => $sku})) { # display flypage template ’flypage ’, $product; } else { # display not found page status ’not_found’; forward ’404’; } }; racke Modern PerlCommerce Modern PerlCommerce Dancer Past and Future Contribution API The End Development & Deployment CPAN/GitHub I http://search.cpan.org/dist/Nitesi/ I http://search.cpan.org/dist/Nitesi-DBI/ I http://search.cpan.org/dist/ Dancer-Plugin-Nitesi/ I https://github.com/racke/Nitesi I https://github.com/racke/Nitesi-DBI I https: //github.com/racke/Dancer-Plugin-Nitesi racke Modern PerlCommerce Modern PerlCommerce Dancer Past and Future Contribution API The End Development & Deployment The End Slides: http://www.linuxia.de/talks/perlcommerce/ perlcommerce-beamer.pdf Project: https://vsc.state.gov/ racke Modern PerlCommerce.