Bluepay-Bluepay20Post-0.15/0000777000175000017500000000000012051202445014450 5ustar ckoisckoisBluepay-Bluepay20Post-0.15/lib/0000777000175000017500000000000011006113113015206 5ustar ckoisckoisBluepay-Bluepay20Post-0.15/lib/Bluepay/0000777000175000017500000000000012051202324016613 5ustar ckoisckoisBluepay-Bluepay20Post-0.15/lib/Bluepay/Bluepay20Post.pm0000644000175000017500000001263512051202324021565 0ustar ckoisckoispackage Bluepay::Bluepay20Post; $VERSION = '0.15'; use strict; use warnings; # Required modules use Digest::MD5 qw(md5_hex); use LWP::UserAgent; use URI::Escape; ## Bluepay20Post default fields ## my $URL = 'https://secure.bluepay.com/interfaces/bp20post'; my $MODE = "TEST"; =head1 NAME Bluepay::Bluepay20Post =head1 VERSION Version: 0.15 November 2012 =head1 SYNOPSIS Bluepay::Bluepay20Post - The BluePay 2.0 Post interface =head1 DESCRIPTION Bluepay::Bluepay20Post is a Perl based implementation for interaction with the Bluepay 2.0 Post interface. Bluepay20Post accepts the parameters needed for the Bluepay20Post and sends the Post request to Bluepay via HTTPS. Bluepay20Post has been developed on Windows XP, but should work on any OS where Perl is installed. =head1 RUNNING Bluepay::Bluepay20Post use Bluepay::Bluepay20Post; # Create object my $bp20obj = Bluepay::Bluepay20Post->new(); # Assign values $bp20Obj->{ACCOUNT_ID} = "myaccountid"; $bp20Obj->{SECRET_KEY} = 'mysecretkey'; $bp20Obj->{TRANS_TYPE} = 'SALE'; $bp20Obj->{MODE} = 'TEST'; # Default is TEST --> Set to LIVE for live tx $bp20Obj->{AMOUNT} = '3.01'; # ODD returns Approved, EVEN returns Declined in TEST mode $bp20Obj->{PAYMENT_ACCOUNT} = '4111111111111111'; # VISA Test Card $bp20Obj->{CARD_EXPIRE} = '0808'; ## PLEASE REVIEW THE BP20 POST DOCUMENTATION TO SEE ALL REQUIRED/POSSIBLE VALUES ## REFERENCE THEM BY NAME DIRECTLY # Post --> Results contains the name value pair string of the response # In this format: TRANS_ID=&STATUS=&AVS=&CVV2=&MESSAGE=&REBID= my $results = $bp20Obj->Post(); # Can also retrieve the results directly from the object print $bp20Obj->{TRANS_ID} . "\n"; print $bp20Obj->{STATUS} . "\n"; print $bp20Obj->{AVS} . "\n"; print $bp20Obj->{CVV2} . "\n"; print $bp20Obj->{AVS} . "\n"; print $bp20Obj->{AUTH_CODE} . "\n"; print $bp20Obj->{MESSAGE} . "\n"; print $bp20Obj->{REBID} . "\n"; =head1 METHODS =head2 new Creates a new instance of a Bluepay::Bluepay20Post object =cut # New sub new { my $class = shift; my $self = {}; # allocate new hash for object bless($self, $class); # Set defaults $self->{URL} = $URL; $self->{MODE} = $MODE; # return object return $self; } =head2 Post Posts the data to the Bluepay::Bluepay20Post interface =cut sub Post { my $self = shift; ## Create TAMPER_PROOF_SEAL: # The TAMPER_PROOF_SEAL is an MD5 checksum of your SECRET KEY and a few transaction parameters. # The TAMPER_PROOF_SEAL is currently calculated as follows: # md5(SECRET KEY + ACCOUNT_ID + TRANS_TYPE + AMOUNT + MASTER_ID + NAME1 + PAYMENT_ACCOUNT) # where '+' indicates string concantenation and undefined fields are concantenated as '' (null string) my $TAMPER_PROOF_DATA = ($self->{SECRET_KEY} || '') . ($self->{ACCOUNT_ID} || '') . ($self->{TRANS_TYPE} || '') . ($self->{AMOUNT} || '') . ($self->{MASTER_ID} || '') . ($self->{NAME1} || '') . ($self->{PAYMENT_ACCOUNT} || ''); my $TAMPER_PROOF_SEAL = md5_hex $TAMPER_PROOF_DATA;; # Create request (encode) my $request = $self->{URL} . "\?TAMPER_PROOF_SEAL=" . uri_escape($TAMPER_PROOF_SEAL || ''); while ( my ($key, $value) = each(%$self) ) { if ($key eq 'SECRET_KEY') { next; } $request .= "&$key=" . uri_escape($value || ''); } # Create Agent my $ua = new LWP::UserAgent; #my $response = $ua->Post("$request"); #OLD my $response = $ua->get("$request"); my $content = $response->content; chomp $content; # Parse Response # Split the name-value pairs my @pairs = split(/&/, $content); foreach my $pair (@pairs) { my ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $self->{$name} = $value; } # Return return $content; } =head1 MODULES This script has some dependencies that need to be installed before it can run. You can use cpan to install the modules. They are: - Digest::MD5 - LWP::UserAgent - URI::Escape =head1 AUTHOR The Bluepay::Bluepay20Post perl module was written by Christopher Kois . =head1 COPYRIGHTS The Bluepay::Bluepay20Post package is Copyright (c) April, 2008 by BluePay, Inc. http://www.bluepay.com All rights reserved. You may distribute this module under the terms of GNU General Public License (GPL). Module Copyrights: - The Digest::MD5 module is Copyright (c) 1998-2003 Gisle Aas. Available at: http://search.cpan.org/~gaas/Digest-MD5-2.36/MD5.pm - The LWP::UserAgent module is Copyright (c) 1995-2008 Gisle Aas. Available at: http://search.cpan.org/~gaas/libwww-perl-5.812/lib/LWP/UserAgent.pm - The URI::Escape module is Copyright (c) 1995-2004 Gisle Aas. Available at: http://search.cpan.org/~gaas/URI-1.36/URI/Escape.pm NOTE: Each of these modules may have other dependencies. The modules listed here are the modules that Bluepay::Bluepay20Post specifically references. =head1 SUPPORT/WARRANTY Bluepay::Bluepay20Post is free Open Source software. This code is Free. You may use it, modify it, redistribute it. If you do make modifications that are useful, please donate the changes back to BluePay. =head1 KNOWN BUGS: This is version 0.15 of Bluepay::Bluepay20Post. There are currently no known bugs. =cut 1; Bluepay-Bluepay20Post-0.15/MANIFEST0000644000175000017500000000014011006112724015567 0ustar ckoisckoisChanges lib/Bluepay/Bluepay20Post.pm Makefile.PL MANIFEST This list of files META.yml README Bluepay-Bluepay20Post-0.15/Changes0000644000175000017500000000040012051202051015722 0ustar ckoisckoisRevision history for Perl extension Bluepay::Bluepay20Post. 0.01 Mon Apr 28 2008 - original version; 0.10 Tue Apr 29 2008 - name revision; - updated hash references to future-proof module; 0.15 Thu Nov 15 2012 - updated URL; - updated README; Bluepay-Bluepay20Post-0.15/META.yml0000644000175000017500000000060212051202445015713 0ustar ckoisckois# http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Bluepay-Bluepay20Post version: 0.15 version_from: lib/Bluepay/Bluepay20Post.pm installdirs: site requires: Digest::MD5 2.36 LWP::UserAgent 5.81 URI::Escape 1.36 distribution_type: module generated_by: ExtUtils::MakeMaker version 6.16 Bluepay-Bluepay20Post-0.15/README0000644000175000017500000000633412051202277015335 0ustar ckoisckoisNAME Bluepay::Bluepay20Post VERSION Version: 0.15 November 2012 SYNOPSIS Bluepay::Bluepay20Post - The BluePay 2.0 Post interface DESCRIPTION Bluepay::Bluepay20Post is a Perl based implementation for interaction with the Bluepay 2.0 Post interface. Bluepay20Post accepts the parameters needed for the Bluepay20Post and sends the Post request to Bluepay via HTTPS. Bluepay20Post has been developed on Windows XP, but should work on any OS where Perl is installed. RUNNING Bluepay::Bluepay20Post use Bluepay::Bluepay20Post; # Create object my $bp20obj = Bluepay::Bluepay20Post->new(); # Assign values $bp20Obj->{ACCOUNT_ID} = "myaccountid"; $bp20Obj->{SECRET_KEY} = 'mysecretkey'; $bp20Obj->{TRANS_TYPE} = 'SALE'; $bp20Obj->{MODE} = 'TEST'; # Default is TEST --> Set to LIVE for live tx $bp20Obj->{AMOUNT} = '3.01'; # ODD returns Approved, EVEN returns Declined in TEST mode $bp20Obj->{PAYMENT_ACCOUNT} = '4111111111111111'; # VISA Test Card $bp20Obj->{CARD_EXPIRE} = '0808'; ## PLEASE REVIEW THE BP20 POST DOCUMENTATION TO SEE ALL REQUIRED/POSSIBLE VALUES ## REFERENCE THEM BY NAME DIRECTLY # Post --> Results contains the name value pair string of the response # In this format: TRANS_ID=&STATUS=&AVS=&CVV2=&MESSAGE=&REBID= my $results = $bp20Obj->Post(); # Can also retrieve the results directly from the object print $bp20Obj->{TRANS_ID} . "\n"; print $bp20Obj->{STATUS} . "\n"; print $bp20Obj->{AVS} . "\n"; print $bp20Obj->{CVV2} . "\n"; print $bp20Obj->{AVS} . "\n"; print $bp20Obj->{AUTH_CODE} . "\n"; print $bp20Obj->{MESSAGE} . "\n"; print $bp20Obj->{REBID} . "\n"; METHODS new Creates a new instance of a Bluepay::Bluepay20Post object Post Posts the data to the Bluepay::Bluepay20Post interface MODULES This script has some dependencies that need to be installed before it can run. You can use cpan to install the modules. They are: - Digest::MD5 - LWP::UserAgent - URI::Escape AUTHOR The Bluepay::Bluepay20Post perl module was written by Christopher Kois . COPYRIGHTS The Bluepay::Bluepay20Post package is Copyright (c) April, 2008 by BluePay, Inc. http://www.bluepay.com All rights reserved. You may distribute this module under the terms of GNU General Public License (GPL). Module Copyrights: - The Digest::MD5 module is Copyright (c) 1998-2003 Gisle Aas. Available at: http://search.cpan.org/~gaas/Digest-MD5-2.36/MD5.pm - The LWP::UserAgent module is Copyright (c) 1995-2008 Gisle Aas. Available at: http://search.cpan.org/~gaas/libwww-perl-5.812/lib/LWP/UserAgent.pm - The URI::Escape module is Copyright (c) 1995-2004 Gisle Aas. Available at: http://search.cpan.org/~gaas/URI-1.36/URI/Escape.pm NOTE: Each of these modules may have other dependencies. The modules listed here are the modules that Bluepay::Bluepay20Post specifically references. SUPPORT/WARRANTY Bluepay::Bluepay20Post is free Open Source software. This code is Free. You may use it, modify it, redistribute it. If you do make modifications that are useful, please donate the changes back to BluePay. KNOWN BUGS This is version 0.15 of Bluepay::Bluepay20Post. There are currently no known bugs. Bluepay-Bluepay20Post-0.15/Makefile.PL0000644000175000017500000000070711006112724016421 0ustar ckoisckoisuse ExtUtils::MakeMaker; my $me = "lib/Bluepay/Bluepay20Post.pm"; WriteMakefile( 'NAME' => 'Bluepay::Bluepay20Post', 'VERSION_FROM' => $me, 'PREREQ_PM' => { 'Digest::MD5' => 2.36, 'LWP::UserAgent' => 5.81, 'URI::Escape' => 1.36, }, ($] < 5.005 ? () : ( ABSTRACT_FROM => $me, AUTHOR => 'Christopher Kois ') ), );