Stefan Hornburg (Racke) @linuxia.de 14th German Perl-Workshop, 28th February 2012, Erlangen
Caveats Alternatives Interchange Around since 1995. Fast and stable. Flexible and extensible.
Caveats Alternatives Showcases Backcountry http://www.backcountry.com/ FragnanceNet http://www.fragrancenet.com/
Caveats Alternatives My projects 20 projects 6 countries 80% income
Caveats Alternatives Interchange Sounds wonderful!
Caveats Alternatives Interchange Sounds wonderful! Really?
Caveats Alternatives Community Small group of developers Little activity Same people Not part of CPAN
Caveats Alternatives Developer Monolithic Same codebase Hard to find things
Caveats Alternatives User Obscure templating Missing extensions Bad demo
Caveats Alternatives Past
Caveats Alternatives Alternatives to Interchange Handel Agora Business::Cart::Generic
We need a plan! Modern Perl Policy Problem with Existing Codebase
We need a plan! Modern Perl Policy Problem with Existing Codebase Missing alternatives
We need a plan! Modern Perl Policy Problem with Existing Codebase Missing alternatives Strong competitors
We need a plan! Modern Perl Policy We need a plan!
We need a plan! Modern Perl Policy Rewrite from scratch?
We need a plan! Modern Perl Policy Rewrite from scratch? Too much work?
We need a plan! Modern Perl Policy Rewrite from scratch? Too much work? Modern Perl to the rescue!
We need a plan! Modern Perl Policy Modern Perl Plack/PSGI OO Moose Moo Web Frameworks Dancer Catalyst Mojolicious
We need a plan! Modern Perl Policy Delegated Tasks Dispatching requests Parameter parsing Session handling Template engine
We need a plan! Modern Perl Policy Extensions Bundles Plugins Hooks
We need a plan! Modern Perl Policy Policy KISS Components Assumptions Expressive
We need a plan! Modern Perl Policy
We need a plan! Modern Perl Policy Assumptions Cart Session DBI Webservice *
We need a plan! Modern Perl Policy Assumptions Account Manager DBI LDAP * OpenID *
We need a plan! Modern Perl Policy Assumptions Templating Engine Template::Toolkit Template::Flute
We need a plan! Modern Perl Policy Assumptions Web framework Catalyst Dancer Mojolicious
We need a plan! Modern Perl Policy Preferences Dancer Template::Flute DBI
We need a plan! Modern Perl Policy Features Navigation Cart Checkout Accounts
Cart Interchange Cart Checkout Products Accounts and Access Control Forms Web Services SKU, Name, Quantity, Price Price > 0 Combines automatically Multiple carts Storage everywhere Price caching
Nitesi::Cart Methods Interchange Cart Checkout Products Accounts and Access Control Forms Web Services use Dancer : : Plugin : : N i t e s i ; cart >add ( sku => POM253, name => Pomelo, p r i c e => 3.00, q u a n t i t y => 1 0 ) ; cart >remove ( sku => POM253 ) ; cart >count ( ) ; cart >c l e a r ( ) ; cart >t o t a l ( ) ; cart >s u b t o t a l ( ) ;
Everything is a Cart Interchange Cart Checkout Products Accounts and Access Control Forms Web Services Saved Carts Wishlists Collections
Multiple Carts Interchange Cart Checkout Products Accounts and Access Control Forms Web Services c a r t ( w i s h l i s t ) >add ( sku => ORA322, name => Orange, p r i c e => 2.00, q u a n t i t y => 5 ) ;
Cart Backends Interchange Cart Checkout Products Accounts and Access Control Forms Web Services Session DBI
Inventory Check Interchange Cart Checkout Products Accounts and Access Control Forms Web Services MinQuantityField MaxQuantityField min_quantity i n v e n t o r y : q u a n t i t y
Inventory Check Hook Interchange Cart Checkout Products Accounts and Access Control Forms Web Services hook before_ cart_ add => sub { my ( $cart, $item ) = @_; my ( $ i n v e n t o r y ) ; $ i n v e n t o r y = query >s e l e c t _ f i e l d ( t a b l e => products, f i e l d => i n v e n t o r y, where => { sku => $item >{sku } } ) ; } ; i f ( $item >{ q u a n t i t y } > $ i n v e n t o r y ) { $item >{ e r r o r } = Out of stock ; }
Cart Hooks Interchange Cart Checkout Products Accounts and Access Control Forms Web Services before_cart_add after_cart_add before_cart_update after_cart_update before_cart_remove after_cart_remove
Checkout Interchange Cart Checkout Products Accounts and Access Control Forms Web Services Taxes Shipping Payment Invoice
Payment Interchange Cart Checkout Products Accounts and Access Control Forms Web Services Business::CreditCard Business::OnlinePayment
charge Keyword Interchange Cart Checkout Products Accounts and Access Control Forms Web Services $tx = charge ( gateway => B r a i n t r e e, amount => cart >t o t a l, card_number => $values >{cc_number }, e x p i r a t i o n => $ e x p i r a t i o n, cvc => $values >{cvc_number } ) ; i f ( $tx >is_success ( ) ) {... } else {... }
Tax Modules on CPAN Interchange Cart Checkout Products Accounts and Access Control Forms Web Services Business::Tax::Canada Business::CA::GST Business::Tax::VAT Business::Tax::VAT::Validation
Shipping Interchange Cart Checkout Products Accounts and Access Control Forms Web Services Simple Shipping Crazy Shipping Shipping
Costs Interchange Cart Checkout Products Accounts and Access Control Forms Web Services Tax Shipping Coupons
Absolute Costs Interchange Cart Checkout Products Accounts and Access Control Forms Web Services $cart >apply_ cost ( amount => 5, name => shipping, l a b e l => Shipping ) ;
Relative Costs Interchange Cart Checkout Products Accounts and Access Control Forms Web Services $cart >apply_ cost ( amount => 0. 19, r e l a t i v e => 1, name => tax, l a b e l => Salestax ) ;
Inclusive Costs Interchange Cart Checkout Products Accounts and Access Control Forms Web Services $cart >apply_ cost ( amount => 0. 19, r e l a t i v e => 1, i n c l u s i v e => 1, name => tax, l a b e l => Salestax ) ;
PDF Invoices Interchange Cart Checkout Products Accounts and Access Control Forms Web Services HTML template Template::Flute::PDF
Product Class Interchange Cart Checkout Products Accounts and Access Control Forms Web Services package N i t e s i : : Product ; use Moo; has sku => ( i s => rw ) ; has name => ( i s => rw ) ; has d e s c r i p t i o n => ( i s => rw ) ; has p r i c e => ( i s => rw ) ; has weight => ( i s => rw ) ; has p r i o r i t y => ( i s => rw ) ; has i n a c t i v e => ( i s => rw ) ; 1;
Product Subclass Interchange Cart Checkout Products Accounts and Access Control Forms Web Services package MyShop : : Product ; use Moo; use base N i t e s i : : Product ; has i n v e n t o r y ( i s => rw ) ; 1;
Product Backend Interchange Cart Checkout Products Accounts and Access Control Forms Web Services package N i t e s i : : Product : : Backend : : DBI ; use Moo; has dbh => ( i s => rw ) ; has query => ( i s => ro, lazy => 1, d e f a u l t => sub { N i t e s i : : Query : : DBI >new ( dbh => s h i f t >dbh ) ; } ) ; sub load {... } ; sub save {... } ; 1;
Accounts Interchange Cart Checkout Products Accounts and Access Control Forms Web Services post / l o g i n => sub { i f ( account >l o g i n ( username => params ( body ) >{username }, password => params ( body ) >{password } ) ) { r e d i r e c t / customerservice ; } else { r e d i r e c t / l o g i n ; } } ;
Accounts Interchange Cart Checkout Products Accounts and Access Control Forms Web Services get / m y w i s h l i s t => sub { i f ( account >a c l ( check => c r e a t e _ w i s h l i s t s ) ) { return template m y w i s h l i s t ; } account >s t a t u s ( l o g i n _ i n f o => Please l o g i n to view w i s h l i s t., l o g i n _ c o n t i n u e => m y w i s h l i s t, ) } ; r e d i r e c t / l o g i n ;
Account manager Interchange Cart Checkout Products Accounts and Access Control Forms Web Services Account Providers Login/Logout Account Information Login status Forgot password Registration
Account Provider Interchange Cart Checkout Products Accounts and Access Control Forms Web Services DBI LDAP * Htpasswd * OpenID * OAuth *
Access Control Interchange Cart Checkout Products Accounts and Access Control Forms Web Services User Roles Permissions
Forms Interchange Cart Checkout Products Accounts and Access Control Forms Web Services Display Validation Storage
Web Services Interchange Cart Checkout Products Accounts and Access Control Forms Web Services REST XML-RPC SOAP
Projects Contribution Slides and Contact Questions The End Nitesi
Projects Contribution Slides and Contact Questions The End Vienna Shopping Cart https://vsc.state.gov/
Projects Contribution Slides and Contact Questions The End Demo Shop Templates Navigation Database Payment Tests
Projects Contribution Slides and Contact Questions The End CPAN/GitHub https://metacpan.org/module/nitesi https://metacpan.org/module/nitesi::dbi/ https://metacpan.org/module/dancer:: Plugin::Nitesi/ https://github.com//nitesi https://github.com//nitesi-dbi https: //github.com//dancer-plugin-nitesi
Projects Contribution Slides and Contact Questions The End Slides and Contact Slides: http://www.linuxia.de/talks/perlcommerce/ perlcommerce-beamer.pdf http://conferences.yapceurope.org/gpw2012/ schedule Email: IRC: @linuxia.de #interchange irc.freenode.net #dancer irc.perl.org
Projects Contribution Slides and Contact Questions The End Questions Question!
Projects Contribution Slides and Contact Questions The End Questions Questions?
Projects Contribution Slides and Contact Questions The End The End Thanks a lot!