Catalyst::Model::PayPal::IPN

Handle Instant Payment Notifications and PayPal Button Generation
Download

Catalyst::Model::PayPal::IPN Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Rafael Kitover
  • Publisher web site:
  • http://search.cpan.org/~rkitover/

Catalyst::Model::PayPal::IPN Tags


Catalyst::Model::PayPal::IPN Description

Handle Instant Payment Notifications and PayPal Button Generation Catalyst::Model::PayPal::IPN is a Perl module that handles all the latest PayPal IPN vars, and provides an easy method for checking that the transaction was successful.There are also convenience methods for generating encrypted and non-encrypted PayPal forms and buttons.SYNOPSIS lib/MyApp/Model/Paypal/IPN.pm package MyApp::Model::Paypal::IPN; use strict; use warnings; use parent 'Catalyst::Model::PayPal::IPN'; 1; myapp.yml paypal: cert_id: 3TFC4UDJER95J page_style: MyApp no_note: 1 no_shipping: 1 lc: GB bn: PP-BuyNowBF Model::Paypal::IPN: debug_mode: 1 encrypt_mode: 0 business_email: ghenry_1188297224_biz@suretecsystems.com currency_code: GBP cert: /home/ghenry/MyApp/root/auth/paypal_certs/www.myapp.net.crt cert_key: /home/ghenry/MyApp/root/auth/paypal_certs/www.myapp.net.key paypal_cert: /home/ghenry/MyApp/root/auth/paypal_certs/paypal_sandbox_cert.pem completion_action: - Subscribe - subscribe - payment - received postback_action: - Subscribe - subscribe - payment - ipn cancellation_action: - Subscribe - subscribe - payment - cancelled MyApp::Controller::Subscribe =head2 ipn Handle PayPal IPN stuff =cut sub ipn : Path('payment/ipn') { my ( $self, $c ) = @_; my $ipn = $c- >model('Paypal::IPN'); if ( $ipn- >is_completed ) { my %ipn_vars = $ipn- >buyer_info(); $c- >stash- >{ipn_vars} = \%ipn_vars; Do stuff here # Just so we reply with something, which in turn sends a HTTP Status 200 # OK, which we need to stop PayPal. # We don't get as we don't use a template and RenderView looks for a # template, a body or status equal to 3XX $c- >res- >body('ok'); } else { # Just so we reply with something, which in turn sends a HTTP Status 200 # OK, which we need to stop PayPal. # We don't get as we don't use a template and RenderView looks for a # template, a body or status equal to 3XX $c- >res- >body('not_ok'); $c- >log- >debug( $record_payment_result- >transmsgtext ) if $c- >debug; $c- >log- >debug( $ipn- >error ) if $ipn- >error && $c- >debug; } } =head2 cancelled Cancelled Payment =cut sub cancelled : Path('payment/cancelled') { my ( $self, $c ) = @_; Do stuff on cancel $c- >stash- >{template} = 'user/subscribe/cancelled.tt'; } =head2 generate_paypal_buttons =cut sub generate_paypal_buttons : Private { my ( $self, $c ) = @_; if ( $c- >stash- >{all_buttons} ) { $c- >stash- >{subtypes} = ; for my $tariff ( @{ $c- >stash- >{subtypes} } ) { next if $tariff- >tariffid == 1; my ?ta = ( #cert_id = > $c- >config- >{paypal}- >{cert_id}, cmd = > '_xclick', item_name = > $tariff- >itemdesc, item_number = > $tariff- >tariffid, amount = > $tariff- >peruser, page_style = > $c- >config- >{paypal}- >{page_style}, no_shipping = > $c- >config- >{paypal}- >{no_shipping}, no_note = > $c- >config- >{paypal}- >{no_note}, 'lc' = > $c- >config- >{paypal}- >{lc}, bn = > $c- >config- >{paypal}- >{bn}, custom = > $c- >req- >param('subid'), ); if ( $c- >debug ) { for my $param ( keys ?ta ) { $c- >log- >debug( $param . '=' . $data{$param} ); } } $c- >stash- >{unencrypted_form_data} = $c- >model('Paypal::IPN')- >form_info( ?ta ); my @button_info = ( $tariff- >itemdesc, $tariff- >peruser, $c- >stash- >{unencrypted_form_data} ); push @{ $c- >stash- >{unencrypted_buttons} }, @button_info; #$c- >stash- >{encrypted_form_data} = # $c- >model('Paypal::IPN')- >encrypt_form( ?ta ); #my @button_info = ( # $tariff- >itemdesc, $tariff- >peruser, # $c- >stash- >{encrypted_form_data} #); #push @{ $c- >stash- >{encrypted_buttons} }, @button_info; } } } buttons.tt < table > < tr > < td > < td >Price: £ < td class="content" > < form method="post" action="" > < input type="hidden" name="cmd" value="_xclick" > < input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" > < img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1" > < input type="hidden" name="" value="" / > < /form > < /td > < /tr > < tr > < td class="content" > < input type="button" onclick_fckprotectedatt=" onclick="dojo.widget.byId('profdiag').hide();"" value="Close" name="close"/ > < /td > < td class="content" colspan="2" > < a href="#" onclick_fckprotectedatt=" onclick="javascript:window.open('https://www.paypal.com/uk/cgi-bin/webscr?cmd=xpt/cps/popup/OLCWhatIsPayPal-outside','olcwhatispaypal','toolbar=no,location=no, directories=no, status=no, menubar=no, scrollbars=yes,resizable=yes, width=400, height=350');"" > < /td > < /tr > < /table > Requirements: · Perl


Catalyst::Model::PayPal::IPN Related Software