Bluepay-Bluepay20DailyReport-0.25/0000777000175000017500000000000012051203317015761 5ustar ckoisckoisBluepay-Bluepay20DailyReport-0.25/lib/0000777000175000017500000000000011120006070016520 5ustar ckoisckoisBluepay-Bluepay20DailyReport-0.25/lib/Bluepay/0000777000175000017500000000000012051203246020131 5ustar ckoisckoisBluepay-Bluepay20DailyReport-0.25/lib/Bluepay/Bluepay20DailyReport.pm0000644000175000017500000001443712051203000024402 0ustar ckoisckoispackage Bluepay::Bluepay20DailyReport; $VERSION = '0.25'; use strict; use warnings; # Required modules use Digest::MD5 qw(md5_hex); use LWP::UserAgent; use URI::Escape; use Text::CSV; ## Bluepay20DailyReport default fields ## my $URL = 'https://secure.bluepay.com/interfaces/bpdailyreport'; =head1 NAME Bluepay::Bluepay20DailyReport =head1 VERSION Version: 0.25 November 2012 =head1 SYNOPSIS Bluepay::Bluepay20DailyReport - The BluePay 2.0 Daily Report interface =head1 DESCRIPTION Bluepay::Bluepay20DailyReport is a Perl based implementation for interaction with the Bluepay 2.0 Daily Report interface. The Bluepay 2.0 Daily Report interface is intended to be polled by a merchant on a daily basis, to get updates on VOID/DECLINED/SETTLED status for transactions on the day prior. Bluepay20DailyReport interface has been developed on Windows XP, but should work on any OS where Perl is installed. =head1 RUNNING Bluepay::Bluepay20DailyReport use Bluepay::Bluepay20DailyReport; # Create the object my $bp20Obj = Bluepay::Bluepay20DailyReport->new(); # Populate fields for tx $bp20Obj->{ACCOUNT_ID} = "myaccountid"; $bp20Obj->{SECRET_KEY} = 'mysecretkey'; $bp20Obj->{REPORT_START_DATE} = "2008-05-01"; # These are the dates within which transactions will be reported. $bp20Obj->{REPORT_END_DATE} = "2008-05-02"; $bp20Obj->{PAYMENT_TYPE} = 'ACH'; # ACH or CREDIT # Post data to retrieve tx results my $postResults = $bp20Obj->post(); # If result is array, SUCCESS if(ref($postResults) eq 'ARRAY') { foreach my $result (@$postResults) { print "Tx Info: " . $result->{id} . "\n"; while ( my ($key, $value) = each(%$result) ) { print "$key => $value\n"; } print "\n"; } } # ELSE, print error else { print "$postResults\n"; } =head1 METHODS =head2 new Creates a new instance of a Bluepay::Bluepay20DailyReport object =cut # New sub new { my $class = shift; my $self = {}; # allocate new hash for object bless($self, $class); # Set defaults $self->{URL} = $URL; # return object return $self; } =head2 post Posts the data to the Bluepay::Bluepay20DailyReport interface =cut sub post { my $self = shift; ## Create TAMPER_PROOF_SEAL: # TAMPER_PROOF_SEAL - And md5 hash used to verify the request. This md5 should be generated as follows: # 1) Create a string consisting of your Bluepay SECRET_KEY, ACCOUNT_ID, and the REPORT_START_DATE # and REPORT_END_DATE concatenated together. For example: # "ABCDABCDABCDABCDABCDABCD1234123412342006-08-082006-08-09" # 2) Calculate the md5 of the string created in step 1. # 3) Convert the md5 to hexadecimal encoding, if necessary. At this point it should # be exactly 32 characters in length. # 4) Submit the hexadecimal md5 with your request, with the name "TAMPER_PROOF_SEAL". my $TAMPER_PROOF_DATA = ($self->{SECRET_KEY} || '') . ($self->{ACCOUNT_ID} || '') . ($self->{REPORT_START_DATE} || '') . ($self->{REPORT_END_DATE} || ''); 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 my @rptResponse; my $rptPos = 0; my $rowPos = 0; my @columns; my @records = split(/\n/, $content); my $numberOfACHs = 0; my $csv = Text::CSV->new; foreach my $record (@records) { chomp $record; if ($csv->parse($record)) { my %reportRepsonseHash; my @fields = $csv->fields; my $fieldPos = 0; if ($rowPos == 0) { @columns = @fields; $rowPos++; next; } for my $field (@fields) { my $colName = $columns[$fieldPos]; $reportRepsonseHash{$colName} = $field || ""; $fieldPos++; } $rptResponse[$rptPos] = \%reportRepsonseHash; $rptPos++; } else { return $csv->error_input . ' - ' . $content; } # Return CSV error } # Return if ($rowPos == 1 and length(@columns) == 1) { return $content; } # If nothing parsed, print error return \@rptResponse; } =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 - Crypt::SSLeay - URI::Escape - Text::CSV =head1 AUTHOR The Bluepay::Bluepay20DailyReport perl module was written by Christopher Kois . =head1 COPYRIGHTS The Bluepay::Bluepay20DailyReport 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 Crypt::SSLeay module is Copyright (c) 2006-2007 David Landgren. Available at: http://search.cpan.org/~dland/Crypt-SSLeay-0.57/SSLeay.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 - The Text::CSV module is Copyright (c) 2007-2008 Makamaka Hannyaharamitu. Available at: http://search.cpan.org/~makamaka/Text-CSV-1.04/lib/Text/CSV.pm NOTE: Each of these modules may have other dependencies. The modules listed here are the modules that Bluepay::Bluepay20DailyReport specifically references. =head1 SUPPORT/WARRANTY Bluepay::Bluepay20DailyReport 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.25 of Bluepay::Bluepay20DailyReport. There are currently no known bugs. =cut 1; Bluepay-Bluepay20DailyReport-0.25/MANIFEST0000644000175000017500000000014711005625460017115 0ustar ckoisckoisChanges lib/Bluepay/Bluepay20DailyReport.pm Makefile.PL MANIFEST This list of files META.yml README Bluepay-Bluepay20DailyReport-0.25/Changes0000644000175000017500000000040212051203317017244 0ustar ckoisckoisRevision history for Perl extension Bluepay::Bluepay20DailyReport. 0.15 Tue May 06 2008 - original version; 0.20 Wed Dec 10 2008 - added Crypt::SSLeay in meta data; 0.25 Thu Nov 15 2012 - updated file extension of module to .pm; - updated README; Bluepay-Bluepay20DailyReport-0.25/META.yml0000644000175000017500000000066412051202435017234 0ustar ckoisckois# http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Bluepay-Bluepay20DailyReport version: 0.25 version_from: lib/Bluepay/Bluepay20DailyReport.pm installdirs: site requires: Digest::MD5 2.36 LWP::UserAgent 5.81 Crypt::SSLeay 0.57 URI::Escape 1.36 Text::CSV 1.04 distribution_type: module generated_by: ExtUtils::MakeMaker version 6.16 Bluepay-Bluepay20DailyReport-0.25/README0000644000175000017500000000667412051202641016651 0ustar ckoisckoisNAME Bluepay::Bluepay20DailyReport VERSION Version: 0.25 November 2012 SYNOPSIS Bluepay::Bluepay20DailyReport - The BluePay 2.0 Daily Report interface DESCRIPTION Bluepay::Bluepay20DailyReport is a Perl based implementation for interaction with the Bluepay 2.0 Daily Report interface. The Bluepay 2.0 Daily Report interface is intended to be polled by a merchant on a daily basis, to get updates on VOID/DECLINED/SETTLED status for transactions on the day prior. Bluepay20DailyReport interface has been developed on Windows XP, but should work on any OS where Perl is installed. RUNNING Bluepay::Bluepay20DailyReport use Bluepay::Bluepay20DailyReport; # Create the object my $bp20Obj = Bluepay::Bluepay20DailyReport->new(); # Populate fields for tx $bp20Obj->{ACCOUNT_ID} = "myaccountid"; $bp20Obj->{SECRET_KEY} = 'mysecretkey'; $bp20Obj->{REPORT_START_DATE} = "2008-05-01"; # These are the dates within which transactions will be reported. $bp20Obj->{REPORT_END_DATE} = "2008-05-02"; $bp20Obj->{PAYMENT_TYPE} = 'ACH'; # ACH or CREDIT # Post data to retrieve tx results my $postResults = $bp20Obj->post(); # If result is array, SUCCESS if(ref($postResults) eq 'ARRAY') { foreach my $result (@$postResults) { print "Tx Info: " . $result->{id} . "\n"; while ( my ($key, $value) = each(%$result) ) { print "$key => $value\n"; } print "\n"; } } # ELSE, print error else { print "$postResults\n"; } METHODS new Creates a new instance of a Bluepay::Bluepay20DailyReport object post Posts the data to the Bluepay::Bluepay20DailyReport 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 - Crypt::SSLeay - URI::Escape - Text::CSV AUTHOR The Bluepay::Bluepay20DailyReport perl module was written by Christopher Kois . COPYRIGHTS The Bluepay::Bluepay20DailyReport 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 Crypt::SSLeay module is Copyright (c) 2006-2007 David Landgren. Available at: http://search.cpan.org/~dland/Crypt-SSLeay-0.57/SSLeay.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 - The Text::CSV module is Copyright (c) 2007-2008 Makamaka Hannyaharamitu. Available at: http://search.cpan.org/~makamaka/Text-CSV-1.04/lib/Text/CSV.pm NOTE: Each of these modules may have other dependencies. The modules listed here are the modules that Bluepay::Bluepay20DailyReport specifically references. SUPPORT/WARRANTY Bluepay::Bluepay20DailyReport 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.25 of Bluepay::Bluepay20DailyReport. There are currently no known bugs. Bluepay-Bluepay20DailyReport-0.25/Makefile.PL0000644000175000017500000000102411120005506017720 0ustar ckoisckoisuse ExtUtils::MakeMaker; my $me = "lib/Bluepay/Bluepay20DailyReport.pm"; WriteMakefile( 'NAME' => 'Bluepay::Bluepay20DailyReport', 'VERSION_FROM' => $me, 'PREREQ_PM' => { 'Digest::MD5' => 2.36, 'LWP::UserAgent' => 5.81, 'Crypt::SSLeay' => 0.57, 'URI::Escape' => 1.36, 'Text::CSV' => 1.04, }, ($] < 5.005 ? () : ( ABSTRACT_FROM => $me, AUTHOR => 'Christopher Kois ') ), );