Catalyst-Model-PayPal-IPN

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

                        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 %data ) {
                            $c->log->debug( $param . '=' . $data{$param} );
                        }
                    }
                    $c->stash->{unencrypted_form_data} =
                      $c->model('Paypal::IPN')->form_info( \%data );

                    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( \%data );

                    #my @button_info = (
                    #    $tariff->itemdesc, $tariff->peruser,
                    #    $c->stash->{encrypted_form_data}
                    #);
                    #push @{ $c->stash->{encrypted_buttons} }, \@button_info;
                }
            }
        }

        buttons.tt

        <table>
            [% FOREACH button IN unencrypted_buttons %]
                <tr>
                    <td><b>[% button.0 %]</b></td>
                    <td><b>Price:</b> £[% button.1 %]</td>
                    <td class="content">
                        <form method="post" action="[% c.model('Paypal::IPN').paypal_gateway %]">
                        <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">
                [% FOREACH key IN button.2.keys %]
                        <input type="hidden" name="[% key %]" value="[% button.2.$key %]" />
                [% END %]
                        </form>
                    </td>
                </tr>
            [% END %]
                <tr>
                    <td class="content">
                        <input type="button" onclick="dojo.widget.byId('profdiag').hide();" value="Close" name="close"/>
                    </td>
                    <td class="content" colspan="2">
                        <a href="#" 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,...
    alt="Solution Graphics"></a>
                    </td>
                </tr>
        </table>

DESCRIPTION
    This model 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.

    See Business::PayPal::IPN for more info.

    WARNING: this module does not have real tests yet, if you encounter
    problems please report them via <http://rt.cpan.org/> .

INTERFACE
  build_paypal_gateway
    If debug_mode is on, returns sandbox url, otherwise normal PayPal
    gateway

  is_completed
    Calls is_completed from Business::PayPal::IPN

  error
    Calls error from Business::PayPal::IPN

  buyer_info
    Returns IPN vars via Business::PayPal::IPN

    See
    <https://www.paypal.com/IntegrationCenter/ic_ipn-pdt-variable-reference.
    html>

  correlation_info
    Returns a hashref of amount, invoice and custom.

  form_info
    Takes a hashref and returns form data for looping through to create your
    form.

    See SYNOPSIS

  encrypt_form
    Encrypts form data.

        $c->model('Paypal::IPN')->encrypt_form( \%data );

CONFIGURATION AND ENVIRONMENT
    The usual techniques for suppling model configuration data in Catalyst
    apply, but the follow should be present:

        Model::Paypal::IPN:
            debug_mode: 1
            encrypt_mode: 0
            business_email: ghenry_1188297224_biz@suretecsystems.com
            currency_code: GBP
            completion_action:
                - Subscribe



( run in 0.843 second using v1.01-cache-2.11-cpan-364913b4093 )