The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Business::OnlinePayment::PlugnPay - plugnpay backend for Business::OnlinePayment

SYNOPSIS

  use Business::OnlinePayment;
  
  my $tx = new Business::OnlinePayment( 'PlugnPay' );
  
  # See the module documentation for details of content()
  $tx->content(
      type           => 'CC',
      action         => 'Normal Authorization',
      description    => 'Business::OnlinePayment::plugnpay test',
      amount         => '49.95',
      invoice_number => '100100',
      customer_id    => 'jef',
      name           => 'Jeff Finucane',
      address        => '123 Anystreet',
      city           => 'Anywhere',
      state          => 'GA',
      zip            => '30004',
      email          => 'plugnpay@weasellips.com',
      card_number    => '4111111111111111',
      expiration     => '12/09',
      cvv2           => '123',
      order_number   => 'string',
  );
  
  $tx->submit();
  
  if ( $tx->is_success() ) {
      print(
          "Card processed successfully: ", $tx->authorization, "\n",
          "order number: ",                $tx->order_number,  "\n",
          "CVV2 response: ",               $tx->cvv2_response, "\n",
          "AVS code: ",                    $tx->avs_code,      "\n",
      );
  }
  else {
      print(
          "Card was rejected: ", $tx->error_message, "\n",
          "order number: ",      $tx->order_number,  "\n",
      );
  }

DESCRIPTION

This module is a back end driver that implements the interface specified by Business::OnlinePayment to support payment handling via plugnpay's payment solution.

See Business::OnlinePayment for details on the interface this modules supports.

Standard methods

set_defaults()

This method sets the 'server' attribute to 'pay1.plugnpay.com' and the port attribute to '443'. This method also sets up the "Module specific methods" described below.

submit()

Unofficial methods

This module provides the following methods which are not officially part of the standard Business::OnlinePayment interface (as of 3.00_06) but are nevertheless supported by multiple gateways modules and expected to be standardized soon:

order_number()
avs_code()
cvv2_response()

Module specific methods

This module provides the following methods which are not currently part of the standard Business::OnlinePayment interface:

expdate_mmyy()
debug()

Settings

The following default settings exist:

server

pay1.plugnpay.com

port

443

path

/payment/pnpremote.cgi

Parameters passed to constructor

If any of the key/value pairs passed to the constructor have a key beginning with "default_" then those values are passed to plugnpay as a the corresponding form field (without the "default_") whenever content(%content) lacks that key.

Handling of content(%content)

The following rules apply to content(%content) data:

type

If 'type' matches one of the following keys it is replaced by the right hand side value:

  'visa'               => 'CC',
  'mastercard'         => 'CC',
  'american express'   => 'CC',
  'discover'           => 'CC',

The value of 'type' is used to set transaction_type(). Currently this module only supports the above values.

Setting plugnpay parameters from content(%content)

The following rules are applied to map data to plugnpay parameters from content(%content):

    # plugnpay param     => $content{<key>}
      publisher-name     => 'login',
      publisher-password => 'password',

      card-amount        => 'amount',
      card-number        => 'card_number',
      card-exp           => \( $month.$year ), # MM/YY from 'expiration'
      ssl_cvv            => 'cvv2',
      order-id           => 'invoice_number',

      card-name          => 'name',
      card-address1      => 'address',
      card-city          => 'city',
      card-state         => 'state',
      card-zip           => 'zip'
      card-country       => 'country',
      orderID            => 'order_number'     # can be set via order_number()

      shipname           => 'ship_first_name' . ' ' . 'ship_last_name',
      address1           => 'ship_address',
      city               => 'ship_city',
      state              => 'ship_state',
      zip                => 'ship_zip',
      country            => 'ship_country',

      transflags         => 'recurring' if ($content{recurring_billing}) eq 'yes',

Mapping plugnpay transaction responses to object methods

The following methods provides access to the transaction response data resulting from a plugnpay request (after submit()) is called:

order_number()

This order_number() method returns the orderID field for transactions to uniquely identify the transaction.

result_code()

The result_code() method returns the resp-code field for transactions. It is the alphanumeric return code indicating the outcome of the attempted transaction.

error_message()

The error_message() method returns the MErrMsg field for transactions. This provides more details about the transaction result.

authorization()

The authorization() method returns the auth-code field, which is the approval code obtained from the card processing network.

avs_code()

The avs_code() method returns the avs-code field from the transaction result.

cvv2_response()

The cvv2_response() method returns the cvvresp field, which is a response message returned with the transaction result.

expdate_mmyy()

The expdate_mmyy() method takes a single scalar argument (typically the value in $content{expiration}) and attempts to parse and format and put the date in MM/YY format as required by the plugnpay specification. If unable to parse the expiration date simply leave it as is and let the plugnpay system attempt to handle it as-is.

debug()

Enable or disble debugging. The value specified here will also set $Business::OnlinePayment::HTTPS::DEBUG in submit() to aid in troubleshooting problems.

COMPATIBILITY

This module implements an interface to the plugnpay Remote Client Integration Specification Rev. 10.03.2007

AUTHORS

Jeff Finucane <plugnpay@weasellips.com>

Based on Business::OnlinePayment::PayflowPro written by Ivan Kohler and Phil Lobbes.

SEE ALSO

perl(1), Business::OnlinePayment, Carp, and the Remote Client Integration Specification from plugnpay.