initial import START
authorivan <ivan>
Tue, 4 Jul 2006 01:18:33 +0000 (01:18 +0000)
committerivan <ivan>
Tue, 4 Jul 2006 01:18:33 +0000 (01:18 +0000)
23 files changed:
Changes [new file with mode: 0644]
MANIFEST [new file with mode: 0644]
Makefile.PL [new file with mode: 0644]
README [new file with mode: 0644]
lib/Business/OnlinePayment/PPIPayMover.pm [new file with mode: 0644]
lib/Business/OnlinePayment/PPIPayMover/AdditionalField.pm [new file with mode: 0644]
lib/Business/OnlinePayment/PPIPayMover/CountryCodes.pm [new file with mode: 0644]
lib/Business/OnlinePayment/PPIPayMover/CreditCardRequest.pm [new file with mode: 0644]
lib/Business/OnlinePayment/PPIPayMover/CreditCardResponse.pm [new file with mode: 0644]
lib/Business/OnlinePayment/PPIPayMover/PayerAuthenticationResponse.pm [new file with mode: 0644]
lib/Business/OnlinePayment/PPIPayMover/SecureHttp.pm [new file with mode: 0644]
lib/Business/OnlinePayment/PPIPayMover/TransactionClient.pm [new file with mode: 0644]
lib/Business/OnlinePayment/PPIPayMover/TransactionRequest.pm [new file with mode: 0644]
lib/Business/OnlinePayment/PPIPayMover/TransactionResponse.pm [new file with mode: 0644]
lib/Business/OnlinePayment/PPIPayMover/URLEncoder.pm [new file with mode: 0644]
lib/Business/OnlinePayment/PPIPayMover/constants.pm [new file with mode: 0644]
t/Business-OnlinePayment-PPIPayMover.t [new file with mode: 0644]
t/bad_card.t [new file with mode: 0644]
t/bop.t [new file with mode: 0644]
t/capture.t [new file with mode: 0644]
t/credit_card.t [new file with mode: 0644]
t/load.t [new file with mode: 0644]
t/void.t [new file with mode: 0644]

diff --git a/Changes b/Changes
new file mode 100644 (file)
index 0000000..09d70aa
--- /dev/null
+++ b/Changes
@@ -0,0 +1,6 @@
+Revision history for Perl extension Business::OnlinePayment::PPIPayMover.
+
+0.01  Fri Jun 30 04:25:46 2006
+       - original version; created by h2xs 1.23 with options
+               -A -X -b 5.5.0 -v 0.01 -n Business::OnlinePayment::PPIPayMover
+
diff --git a/MANIFEST b/MANIFEST
new file mode 100644 (file)
index 0000000..c2f81ba
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,23 @@
+Changes
+Makefile.PL
+MANIFEST
+README
+t/bad_card.t
+t/bop.t
+t/Business-OnlinePayment-PPIPayMover.t
+t/capture.t
+t/credit_card.t
+t/load.t
+t/void.t
+lib/Business/OnlinePayment/PPIPayMover.pm
+lib/Business/OnlinePayment/PPIPayMover/constants.pm
+lib/Business/OnlinePayment/PPIPayMover/AdditionalField.pm 
+lib/Business/OnlinePayment/PPIPayMover/CountryCodes.pm 
+lib/Business/OnlinePayment/PPIPayMover/CreditCardRequest.pm 
+lib/Business/OnlinePayment/PPIPayMover/CreditCardResponse.pm 
+lib/Business/OnlinePayment/PPIPayMover/PayerAuthenticationResponse.pm 
+lib/Business/OnlinePayment/PPIPayMover/SecureHttp.pm
+lib/Business/OnlinePayment/PPIPayMover/TransactionClient.pm
+lib/Business/OnlinePayment/PPIPayMover/TransactionRequest.pm
+lib/Business/OnlinePayment/PPIPayMover/TransactionResponse.pm
+lib/Business/OnlinePayment/PPIPayMover/URLEncoder.pm
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644 (file)
index 0000000..7e0b989
--- /dev/null
@@ -0,0 +1,12 @@
+use 5.005;
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    NAME              => 'Business::OnlinePayment::PPIPayMover',
+    VERSION_FROM      => 'lib/Business/OnlinePayment/PPIPayMover.pm', # finds $VERSION
+    PREREQ_PM         => {}, # e.g., Module::Name => 1.1
+    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
+      (ABSTRACT_FROM  => 'lib/Business/OnlinePayment/PPIPayMover.pm', # retrieve abstract from module
+       AUTHOR         => 'Ivan Kohler <ivan@>') : ()),
+);
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..0b62930
--- /dev/null
+++ b/README
@@ -0,0 +1,18 @@
+Copyright uncertain at this time; based on code API code provided without
+clear licensing... assuming that can be resolved:
+
+Business::OnlinePayment conversion copyright (c) 2006 Ivan Kohler
+All rights reserved. This program is free software; you can redistribute it
+and/or modify it under the same terms as Perl itself.
+
+This is Business::OnlinePayment::PPIPayMover, an Business::OnlinePayment
+backend module for PPI PayMover.  It is only useful if you have a merchant
+account with PPI Paymover: http://www.ppipaymover.com/
+
+Ivan Kohler <ivan-ppipaymover@420.am>
+
+Business::OnlinePayment is a generic interface for processing payments through
+online credit card processors, online check acceptance houses, etc.  (If you
+like buzzwords, call it an "multiplatform ecommerce-enabling middleware
+solution").
+
diff --git a/lib/Business/OnlinePayment/PPIPayMover.pm b/lib/Business/OnlinePayment/PPIPayMover.pm
new file mode 100644 (file)
index 0000000..8ac9bc8
--- /dev/null
@@ -0,0 +1,329 @@
+package Business::OnlinePayment::PPIPayMover;
+
+use strict;
+use vars qw($VERSION @ISA $DEBUG);
+use Carp;
+use Business::OnlinePayment::PPIPayMover::constants;
+use Business::OnlinePayment::PPIPayMover::TransactionClient;
+use Business::OnlinePayment::PPIPayMover::CreditCardRequest;
+use Business::OnlinePayment::PPIPayMover::CountryCodes;
+use Business::OnlinePayment::PPIPayMover::CreditCardResponse;
+
+$VERSION = '0.01';
+@ISA = qw(Business::OnlinePayment);
+$DEBUG = 0;
+
+my $tranclient = new Business::OnlinePayment::PPIPayMover::TransactionClient;
+#my $ccreq = new Business::OnlinePayment::PPIPayMover::CreditCardRequest;
+
+sub set_defaults {
+  my $self = shift;
+
+    #$self->server('secure.linkpt.net');
+    #$self->port('1129');
+
+    $self->build_subs(qw(order_number avs_code));
+
+}
+
+sub map_fields {
+  my $self = shift;
+
+  my %content = $self->content();
+
+  # ACTION MAP
+  #    target types: SALE, ADJUSTMENT, AUTH, CAPTURE, CREDIT, FORCE_AUTH,
+  #                  FORCE_SALE, QUERY_CREDIT, QUERY_PAYMENT or VOID
+  my %actions = (
+    'normal authorization' => 'SALE',
+    'authorization only'   => 'AUTH',
+    'credit'               => 'CREDIT',
+    'post authorization'   => 'CAPTURE',
+    'void'                 => 'VOID',
+  );
+  $content{'action'} = $actions{lc($content{'action'})} || $content{'action'};
+
+  # TYPE MAP
+  my %types = (
+    'visa'              => 'CC',
+    'mastercard'        => 'CC',
+    'american express'  => 'CC',
+    'discover'          => 'CC',
+    'cc'                => 'CC',
+    #'check'
+  );
+  $content{'type'} = $types{lc($content{'type'})} || $content{'type'};
+  $self->transaction_type($content{'type'});
+
+  # stuff it back into %content
+  $self->content(%content);
+}
+
+sub submit {
+  my $self = shift;
+
+    #type          =>
+    #login         =>
+    #password      =>
+    #authorization =>
+
+                   #name
+
+    #order_number
+
+                   #currency          =>
+
+                   #check_type        =>
+                   #account_name      =>
+                   #account_number    => 
+                   #account_type      =>
+                  #bank_name         => 
+                  #routing_code      =>
+                   #customer_org      =>
+                 #customer_ssn      =>
+                 #license_num       =>
+                   #license_state     =>
+                 #license_dob       =>
+                  #get from new() args instead# payee             =>
+                #check_number      =>
+
+                   #recurring_billing => 'cnp_recurring',
+
+  $self->map_fields();
+
+  my %content = $self->content;
+
+  my($month, $year);
+  unless ( $content{action} eq 'CAPTURE'
+           || ( $content{'action'} =~ /^(CREDIT|VOID)$/
+                && exists $content{'order_number'} )
+         ) {
+
+    if (  $self->transaction_type() =~
+            /^(cc|visa|mastercard|american express|discover)$/i
+       ) {
+    } else {
+        Carp::croak("PPIPayMover can't handle transaction type: ".
+                    $self->transaction_type());
+    }
+
+    $content{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/
+      or croak "unparsable expiration $content{expiration}";
+
+    ( $month, $year ) = ( $1, "20$2" );
+    $month = '0'. $month if $month =~ /^\d$/;
+  }
+
+  my $ccreq = new Business::OnlinePayment::PPIPayMover::CreditCardRequest;
+
+  $self->revmap_fields( $ccreq,
+
+    'ChargeTotal'                  => 'amount',
+    'ChargeType'                   => 'action',
+    'CreditCardNumber'             => 'card_number',
+    'CreditCardVerificationNumber' => 'cvv2',
+    'ExpireMonth'                  => \$month,
+    'ExpireYear'                   => \$year,
+
+    'BillAddressOne'               => 'address',
+    #'BillAddressTwo'               => '',
+    'BillCity'                     => 'city',
+    'BillCompany'                  => 'company',
+    'BillCountryCode'              => 'country',
+    #'BillCustomerTitle'            => '',
+    'BillEmail',                   => 'email',
+    'BillFax'                      => 'fax',
+    'BillFirstName'                => 'first_name',
+    'BillLastName'                 => 'last_name',
+    #'BillMiddleName'               => '',
+    'BillNote'                      => '',
+    'BillPhone'                    => 'phone',
+    'BillPostalCode'               => 'zip',
+    'BillStateOrProvince'          => 'state',
+
+    'ShipAddressOne'               => 'ship_address',
+    #'ShipAddressTwo'               => '',
+    'ShipCity'                     => 'ship_city',
+    'ShipCompany'                  => 'ship_company',
+    'ShipCountryCode'              => 'ship_country',
+    #'ShipCustomerTitle'            => '',
+    'ShipEmail',                   => 'ship_email',
+    'ShipFax'                      => 'ship_fax',
+    'ShipFirstName'                => 'ship_first_name',
+    'ShipLastName'                 => 'ship_last_name',
+    #'ShipMiddleName'               => '',
+    'ShipNote'                      => '',
+    'ShipPhone'                    => 'ship_phone',
+    'ShipPostalCode'               => 'ship_zip',
+    'ShipStateOrProvince'          => 'ship_state',
+
+    #'OrderId'                      => 'order_number',
+    'OrderId'                      => (int (rand 999999998) + 1 ), # XXX This can result in duplicate order ids.  You should use your own sequence instead.
+    'BuyerCode'                    => '83487235',
+    'CustomerIPAddress'            => 'customer_ip',
+    'OrderCustomerId'              => 'customer_id',
+    'OrderDescription'             => 'description',
+    #'OrderUserId'                  => '',
+    #'PurchaseOrderNumber'          => '',
+    'TransactionConditionCode'     => \( TCC_CARDHOLDER_NOT_PRESENT_SECURE_ECOMMERCE ),
+    #'ShippingCharge'               => '',
+    #'StateTax'                     => '',
+    #'TaxAmount'                    => '',
+    #'TaxExempt'                    => '',
+
+    'InvoiceNumber'                => 'invoice_number',
+    'Industry'                     => \( RETAIL ),
+    #'FolioNumber'                  => '',
+
+    #'ChargeTotalIncludesRestaurant'
+    #'ChargeTotalIncludesGiftshop'
+    #'ChargeTotalIncludesMinibar'
+    #'ChargeTotalIncludesPhone'
+    #'ChargeTotalIncludesLaundry'
+    #'ChargeTotalIncludesOther'
+
+    #'ServiceRate'
+
+    #'ServiceStartDay'
+    #'ServiceStartMonth'
+    #'ServiceStartYear'
+    #'ServiceEndMonth'
+    #'ServiceEndYear'
+    #'ServiceEndDay'
+
+    #'ServiceNoShow'
+
+    #'ReferenceId'    => '', # XXX Use reference ID for follow-on transactions (CAPTURE, VOID)
+    #'CAVV'
+    #'XID'
+    #'Track1'
+    #'Track2'
+
+
+  );
+
+  # Send the transaction! (test token)
+
+  my $token = $content{'login'};
+  $token = "TEST$token" if $self->test_transaction();
+  
+  my $ccresponse = $tranclient->doTransaction( 
+    "",     # transaction key (?)
+    $ccreq, #cc request
+    $token, #token
+  );
+
+  die $tranclient->GetErrorString unless defined $ccresponse;
+
+  $self->result_code($ccresponse->GetResponseCode);
+  $self->avs_code($ccresponse->GetAVSCode);
+  $self->order_number($ccresponse->GetOrderId);
+
+  if ( $self->result_code == 1 ) { # eq '1' ?
+    $self->is_success(1);
+    #$self->authorization($ccresponse->GetBankApprovalCode);
+    $self->authorization($ccresponse->GetReferenceId); #"Identifier for follow-on transactions"
+  } else {
+    $self->is_success(0);
+    $self->error_message($ccresponse->GetResponseCodeText);
+  }
+
+}
+
+##  print "ResponseCode            : ", $ccresponse->GetResponseCode, "\n";
+##  print "ResponseCodeText        : ", $ccresponse->GetResponseCodeText, "\n";
+#  print "Timestamp               : ", $datetime, "\n";
+#  print "IsoCode                 : ", $ccresponse->GetIsoCode, "\n";
+##  print "OrderId                 : ", $ccresponse->GetOrderId, "\n";
+##  print "BankApprovalCode        : ", $ccresponse->GetBankApprovalCode, "\n";
+#  print "State                   : ", $ccresponse->GetState, "\n";
+#  print "AuthorizedAmount        : ", $ccresponse->GetAuthorizedAmount, "\n";
+#  print "OriginalAuthorizedAmount: ", $ccresponse->GetOriginalAuthorizedAmount,
+#"\n";
+#  print "CapturedAmount          : ", $ccresponse->GetCapturedAmount, "\n";
+#  print "CreditedAmount          : ", $ccresponse->GetCreditedAmount, "\n";
+#  print "TimeStampCreated        : ", $ccresponse->GetTimeStampCreated, "\n";
+##  print "ReferenceId             : ", $ccresponse->GetReferenceId, "\n";
+#  print "BankTransactionId       : ", $ccresponse->GetBankTransactionId, "\n";
+#  print "BatchId                 : ", $ccresponse->GetBatchId, "\n";
+#  #print "AVS Code                : ", $ccresponse->GetAVSCode, "\n";
+
+#this is different from a "normal" B:OP revmap, it sets things in $ccreq
+sub revmap_fields {
+    my($self, $ccreq, %map) = @_;
+    my %content = $self->content();
+    foreach(keys %map) {
+      my $method = "Set$_";
+      my $content = ref($map{$_}) ? ${ $map{$_} } : $content{$map{$_}};
+      $ccreq->$method($content);
+    }
+}
+
+
+1;
+__END__
+
+=head1 NAME
+
+Business::OnlinePayment::PPIPayMover - PPI PayMover backend for Business::OnlinePayment
+
+=head1 SYNOPSIS
+
+  use Business::OnlinePayment;
+
+  my $tx = new Business::OnlinePayment( 'PPIPayMover' );
+
+  $tx->content(
+      login          => '195325FCC230184964CAB3A8D93EEB31888C42C714E39CBBB2E541884485D04B', #token
+      type           => 'VISA',
+      action         => 'Normal Authorization',
+      description    => 'Business::OnlinePayment test',
+      amount         => '49.95',
+      invoice_number => '100100',
+      customer_id    => 'jsk',
+      name           => 'Grub Tetris',
+      address        => '123 Anystreet',
+      city           => 'Anywhere',
+      state          => 'UT',
+      zip            => '84058',
+      email          => 'ivan-ppipaymover@420.am',
+      card_number    => '4007000000027',
+      expiration     => '09/12',
+  );
+  $tx->submit();
+
+  if($tx->is_success()) {
+      print "Card processed successfully: ".$tx->authorization."\n";
+  } else {
+      print "Card was rejected: ".$tx->error_message."\n";
+  }
+
+=head1 SUPPORTED TRANSACTION TYPES
+
+=head2 Visa, MasterCard, American Express, JCB, Discover/Novus, Carte blanche/Di
+ners Club
+
+=head1 DESCRIPTION
+
+For detailed information see L<Business::OnlinePayment>.
+
+=head1 BUGS
+
+=head1 AUTHOR
+
+Ivan Kohler <ivan-ppipaymover@420.am>
+
+=head1 COPYRIGHT AND LICENSE
+
+Based on API components from PPI PayMover provided without clear licensing, so,
+probably not freely licensable at the moment... assuming that can be resolved:
+
+Business::OnlinePayment conversion copyright (c) 2006 Ivan Kohler
+All rights reserved. This program is free software; you can redistribute it
+and/or modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+perl(1), L<Business::OnlinePayment>.
+
+=cut
diff --git a/lib/Business/OnlinePayment/PPIPayMover/AdditionalField.pm b/lib/Business/OnlinePayment/PPIPayMover/AdditionalField.pm
new file mode 100644 (file)
index 0000000..bd2d91e
--- /dev/null
@@ -0,0 +1,102 @@
+\r
+# * AdditionalFields are used to hold fields that do not have separate\r
+# * specifications. Each AdditionalField consists of a name and a value,\r
+# * which are set in the constructor and are retrieved using the get methods.\r
+# * <P>\r
+# * TransactionRequests (including CreditCardRequests) hold\r
+# * a Vector of AdditionalField objects to permit them to be\r
+# * interoperable with future releases.\r
+# * <P>\r
+# * @see TransactionRequest#setAdditionalField\r
+# * @see TransactionRequest#setAdditionalFields\r
+# */\r
+\r
+\r
+#*\r
+# * Make an AdditionalField object with the given name and value.\r
+# * <P>\r
+# * @param name Must not be NULL or "". May not contain ' ', '=', or '+'.\r
+# */\r
+\r
+use strict;\r
+#use overload;\r
+package Business::OnlinePayment::PPIPayMover::AdditionalField;\r
+use overload\r
+'== ' => \&equals;\r
+my $paramSeparator = "&";\r
+\r
+sub new {\r
+  my $class = shift;\r
+  my $self = {};\r
+  my ($name, $value) = @_;  # name and value as two arguements\r
+  $self->{strError} = "";\r
+  if (!$name || $name eq "" ) {\r
+    $self->{strError} .= "AdditionalField constructor: must provide a name";\r
+  }\r
+  if (!$value || $value eq "") {\r
+    $self->{strError} .= "AdditionalField constructor: must provide a value";\r
+  }\r
+  if (index($name, " ") != -1 || index($name, "=") != -1) {\r
+    $self->{strError} .= "AdditionalField constructor: name may not contain space or =";\r
+  }\r
+  if (index($value, " ") != -1 || index($value, "=") != -1) {\r
+    $self->{strError} .= "AdditionalField constructor: value may not contain space or =";\r
+  }\r
+  if (index($value, "+") != -1) {\r
+    $self->{strError} .= "AdditionalField constructor: value may not contain +";\r
+  }\r
+  if (defined $name) { $self->{name} = $name }\r
+  if (defined $value) { $self->{value} = $value }\r
+  \r
+  bless $self, $class;\r
+}\r
+\r
+#**\r
+# * Get the name associated with this AdditionalField object.\r
+# * <P>\r
+# * @return The name of the additional field.\r
+#\r
+sub getName {\r
+  my $self = shift;\r
+  $self->{name};\r
+}\r
+\r
+#**\r
+# * Get the value associated with this AdditionalField object.\r
+# * <P>\r
+# * @return The value of the additional field.\r
+#\r
+sub getValue {\r
+  my $self = shift;\r
+  $self->{value};\r
+}\r
+\r
+sub getError {\r
+  my $self = shift;\r
+  $self->{strError};\r
+}\r
+\r
+#**\r
+# * This method only checks the name field. This is ok because\r
+# * a TransactionRequest is not allowed to have two AdditionalField\r
+# * objects with the same name.\r
+#\r
+sub equals {\r
+  my $self = shift;\r
+  my $other = shift;\r
+  if($self->{name} eq $other->getName) { return 1 }\r
+  else { return 0 };\r
+}\r
+\r
+\r
+sub write {\r
+  my $self = shift;\r
+  my $outString = shift;\r
+  $self->{value} =~ tr/ /+/;\r
+  $$outString .= $self->{name};\r
+  $$outString .= "=";\r
+  $$outString .= $self->{value};\r
+  $$outString .= $paramSeparator;\r
+}\r
+\r
+1;\r
diff --git a/lib/Business/OnlinePayment/PPIPayMover/CountryCodes.pm b/lib/Business/OnlinePayment/PPIPayMover/CountryCodes.pm
new file mode 100644 (file)
index 0000000..049635c
--- /dev/null
@@ -0,0 +1,318 @@
+package Business::OnlinePayment::PPIPayMover::CountryCodes;\r
+\r
+use strict;\r
+use vars qw(@ISA @EXPORT %countryHash);\r
+use Exporter;\r
+\r
+@ISA = qw(Exporter);\r
+@EXPORT = qw(getCountry\r
+  getNumericCountryCode\r
+  isValidCountryCode\r
+getCCodeFromCName);\r
+\r
+# Two Character Country Codes */\r
+%countryHash = ("DZ" => "ALGERIA:012",\r
+  "BJ" => "BENIN:204",\r
+  "BW" => "BOTSWANA:072",\r
+  "BF" => "BURKINA FASO:854",\r
+  "BI" => "BURUNDI:108",\r
+  "CM" => "CAMEROON:120",\r
+  "CV" => "CAPE VERDE:132",\r
+  "CF" => "CENTRAL AFRICAN REPUBLIC:140",\r
+  "TD" => "CHAD:148",\r
+  "KM" => "COMOROS:174",\r
+  "CG" => "CONGO:178",\r
+  "CI" => "COTE DIVOIRE:384",\r
+  "DJ" => "DJIBOUTI:262",\r
+  "EG" => "EGYPT:818",\r
+  "GQ" => "EQUATORIAL GUINEA:226",\r
+  "ER" => "ERITREA:232",\r
+  "ET" => "ETHIOPIA:231",\r
+  "GA" => "GABON:266",\r
+  "GM" => "GAMBIA:270",\r
+  "GH" => "GHANA:288",\r
+  "GN" => "GUINEA:324",\r
+  "GW" => "GUINEA BISSAU:624",\r
+  "KE" => "KENYA:404",\r
+  "LS" => "LESOTHO:426",\r
+  "LR" => "LIBERIA:430",\r
+  "MG" => "MADAGASCAR:450",\r
+  "MW" => "MALAWI:454",\r
+  "ML" => "MALI:466",\r
+  "MR" => "MAURITANIA:478",\r
+  "YT" => "MAYOTTE:175",\r
+  "MA" => "MOROCCO:504",\r
+  "MZ" => "MOZAMBIQUE:508",\r
+  "NA" => "NAMIBIA:516",\r
+  "NE" => "NIGER:562",\r
+  "NG" => "NIGERIA:566",\r
+  "RE" => "REUNION:638",\r
+  "ST" => "SAO TOME AND PRINCIPE:678",\r
+  "SN" => "SENEGAL:686",\r
+  "SL" => "SIERRA LEONE:694",\r
+  "SO" => "SOMALIA:706",\r
+  "ZA" => "SOUTH AFRICA:710",\r
+  "SH" => "ST HELENA:654",\r
+  "SD" => "SUDAN:736",\r
+  "SZ" => "SWAZILAND:748",\r
+  "TZ" => "TANZANIA:834",\r
+  "TG" => "TOGO:768",\r
+  "TN" => "TUNISIA:788",\r
+  "UG" => "UGANDA:800",\r
+  "EH" => "WESTERN SAHARA:732",\r
+  "ZR" => "ZAIRE:180",\r
+  "ZM" => "ZAMBIA:894",\r
+  "ZW" => "ZIMBABWE:716",\r
+  \r
+# Antartica\r
+  "AQ" => "ANTARCTICA:010",\r
+  \r
+# Asia\r
+  "AF" => "AFGHANISTAN:004",\r
+  "BD" => "BANGLADESH:050",\r
+  "BT" => "BHUTAN:064",\r
+  "BN" => "BRUNEI:096",\r
+  "KH" => "CAMBODIA:116",\r
+  "CN" => "CHINA:156",\r
+  "HK" => "HONG KONG:344",\r
+  "IN" => "INDIA:356",\r
+  "ID" => "INDONESIA:360",\r
+  "JP" => "JAPAN:392",\r
+  "KZ" => "KAZAKHSTAN:398",\r
+  "KG" => "KYRGYZSTAN:417",\r
+  "LA" => "LAOS:418",\r
+  "MO" => "MACAU:446",\r
+  "MY" => "MALAYSIA:458",\r
+  "MV" => "MALDIVES:462",\r
+  "MN" => "MONGOLIA:496",\r
+  "NP" => "NEPAL:524",\r
+  "PK" => "PAKISTAN:586",\r
+  "PH" => "PHILIPPINES:608",\r
+  "KR" => "REPUBLIC OF KOREA:410",\r
+  "RU" => "RUSSIA:643",\r
+  "SC" => "SEYCHELLES:690",\r
+  "SG" => "SINGAPORE:702",\r
+  "LK" => "SRI LANKA:144",\r
+  "TW" => "TAIWAN:158",\r
+  "TJ" => "TAJIKISTAN:762",\r
+  "TH" => "THAILAND:764",\r
+  "TM" => "TURKMENISTAN:795",\r
+  "UZ" => "UZBEKISTAN:860",\r
+  "VN" => "VIETNAM:704",\r
+  \r
+# Australia\r
+  "AS" => "AMERICAN SAMOA:016",\r
+  "AU" => "AUSTRALIA:036",\r
+  "FM" => "FEDERATED STATES OF MICRONESIA:583",\r
+  "FJ" => "FIJI:242",\r
+  "PF" => "FRENCH POLYNESIA:258",\r
+  "GU" => "GUAM:316",\r
+  "KI" => "KIRIBATI:296",\r
+  "MH" => "MARSHALL ISLANDS:584",\r
+  "NR" => "NAURU:520",\r
+  "NC" => "NEW CALEDONIA:540",\r
+  "NZ" => "NEW ZEALAND:554",\r
+  "MP" => "NORTHERN MARIANA ISLANDS:580",\r
+  "PW" => "PALAU:585",\r
+  "PG" => "PAPUA NEW GUINEA:598",\r
+  "PN" => "PITCAIRN:612",\r
+  "SB" => "SOLOMON ISLANDS:090",\r
+  "TO" => "TONGA:776",\r
+  "TV" => "TUVALU:798",\r
+  "VU" => "VANUATU:548",\r
+  \r
+# Caribbean\r
+  "AI" => "ANGUILLA:660",\r
+  "AG" => "ANTIGUA AND BARBUDA:028",\r
+  "AW" => "ARUBA:533",\r
+  "BS" => "BAHAMAS:044",\r
+  "BB" => "BARBADOS:052",\r
+  "BM" => "BERMUDA:060",\r
+  "KY" => "CAYMAN ISLANDS:136",\r
+  "DM" => "DOMINICA:212",\r
+  "DO" => "DOMINICAN REPUBLIC:214",\r
+  "GD" => "GRENADA:308",\r
+  "GP" => "GUADELOUPE:312",\r
+  "HT" => "HAITI:332",\r
+  "JM" => "JAMAICA:388",\r
+  "MQ" => "MARTINIQUE:474",\r
+  "AN" => "NETHERLANDS ANTILLES:530",\r
+  "PR" => "PUERTO RICO:630",\r
+  "KN" => "ST KITTS AND NEVIS:659",\r
+  "LC" => "ST LUCIA:662",\r
+  "VC" => "ST VINCENT AND THE GRENADINES:670",\r
+  "TT" => "TRINIDAD AND TOBAGO:780",\r
+  "TC" => "TURKS AND CAICOS ISLANDS:796",\r
+  "VG" => "VIRGIN ISLANDS BRITISH:092",\r
+  "VI" => "VIRGIN ISLANDS USA:850",\r
+  \r
+# Central America\r
+  "BZ" => "BELIZE:084",\r
+  "CR" => "COSTA RICA:188",\r
+  "SV" => "EL SALVADOR:222",\r
+  "GT" => "GUATEMALA:320",\r
+  "HN" => "HONDURAS:340",\r
+  "NI" => "NICARAGUA:558",\r
+  "PA" => "PANAMA:591",\r
+  \r
+#  Europe\r
+  "AL" => "ALBANIA:008",\r
+  "AD" => "ANDORRA:020",\r
+  "AM" => "ARMENIA:051",\r
+  "AT" => "AUSTRIA:040",\r
+  "AZ" => "AZERBAIJAN:031",\r
+  "BY" => "BELARUS:112",\r
+  "BE" => "BELGIUM:056",\r
+  "BG" => "BULGARIA:100",\r
+  "HR" => "CROATIA:191",\r
+  "CY" => "CYPRUS:196",\r
+  "CZ" => "CZECH REPUBLIC:203",\r
+  "DK" => "DENMARK:208",\r
+  "EE" => "ESTONIA:233",\r
+  "FO" => "FAROE ISLANDS:234",\r
+  "FI" => "FINLAND:246",\r
+  "FR" => "FRANCE:250",\r
+  "GE" => "GEORGIA:268",\r
+  "DE" => "GERMANY:276",\r
+  "GI" => "GIBRALTAR:292",\r
+  "GR" => "GREECE:300",\r
+  "GL" => "GREENLAND:304",\r
+  "HU" => "HUNGARY:348",\r
+  "IS" => "ICELAND:352",\r
+  "IE" => "IRELAND:372",\r
+  "IT" => "ITALY:380",\r
+  "LV" => "LATVIA:428",\r
+  "LI" => "LIECHTENSTEIN:438",\r
+  "LT" => "LITHUANIA:440",\r
+  "LU" => "LUXEMBOURG:442",\r
+  "MT" => "MALTA:470",\r
+  "FX" => "METROPOLITAN FRANCE:249",\r
+  "MD" => "MOLDOVA:498",\r
+  "NL" => "NETHERLANDS:528",\r
+  "NO" => "NORWAY:578",\r
+  "PL" => "POLAND:616",\r
+  "PT" => "PORTUGAL:620",\r
+  "RO" => "ROMANIA:642",\r
+  "SK" => "SLOVAKIA:703",\r
+  "SI" => "SLOVENIA:705",\r
+  "ES" => "SPAIN:724",\r
+  "SJ" => "SVALBARD AND JAN MAYEN ISLANDS:744",\r
+  "SE" => "SWEDEN:752",\r
+  "CH" => "SWITZERLAND:756",\r
+  "MK" => "REPUBLIC OF MACEDONIA:807",\r
+  "TR" => "TURKEY:792",\r
+  "UA" => "UKRAINE:804",\r
+  "GB" => "UNITED KINGDOM:826",\r
+  "VA" => "VATICAN CITY:336",\r
+  "YU" => "YUGOSLAVIA:891",\r
+  \r
+# Middle East\r
+  "IL" => "ISRAEL:376",\r
+  "JO" => "JORDAN:400",\r
+  "KW" => "KUWAIT:414",\r
+  "LB" => "LEBANON:422",\r
+  "OM" => "OMAN:512",\r
+  "QA" => "QATAR:634",\r
+  "SA" => "SAUDI ARABIA:682",\r
+  "SY" => "SYRIA:760",\r
+  "AE" => "UNITED ARAB EMIRATES:784",\r
+  "YE" => "YEMEN:887",\r
+  \r
+# North America\r
+  "CA" => "CANADA:124",\r
+  "MX" => "MEXICO:484",\r
+  "US" => "UNITED STATES:840",\r
+  \r
+# South America\r
+  "AR" => "ARGENTINA:032",\r
+  "BO" => "BOLIVIA:068",\r
+  "BR" => "BRAZIL:076",\r
+  "CL" => "CHILE:152",\r
+  "CO" => "COLOMBIA:170",\r
+  "EC" => "EQUADOR:218",\r
+  "FK" => "FALKLAND ISLANDS:238",\r
+  "GF" => "FRENCH GUIANA:254",\r
+  "GY" => "GUYANA:328",\r
+  "PY" => "PARAGUAY:600",\r
+  "PE" => "PERU:604",\r
+  "SR" => "SURINAME:740",\r
+  "UY" => "URUGUAY:858",\r
+  "VE" => "VENEZUELA:862",\r
+  \r
+# Others\r
+  "BH" => "BAHRAIN:048",\r
+  "BV" => "BOUVET ISLANDS:074",\r
+  "IO" => "BRITISH INDIAN OCEAN TERRITORY:086",\r
+  "CX" => "CHRISTMAS ISLANDS:162",\r
+  "CC" => "COCOS KEELING ISLANDS:166",\r
+  "CK" => "COOK ISLAND:184",\r
+  "TP" => "EAST TIMOR:626",\r
+  "TF" => "FRENCH SOUTHERN TERRITORIES:260",\r
+  "HM" => "HEARD AND MCDONALD ISLANDS:334",\r
+  "MU" => "MAURITIUS:480",\r
+  "MC" => "MONACO:492",\r
+  "MS" => "MONTSERRAT:500",\r
+  "MM" => "MYANMAR:104",\r
+  "NU" => "NIUE:570",\r
+  "NF" => "NORFOLK ISLAND:574",\r
+  "WS" => "SAMOA:882",\r
+  "SM" => "SAN MARINO:674",\r
+  "PM" => "ST PIERRE AND MIQUELON:666",\r
+  "TK" => "TOKELAU:772",\r
+  "UM" => "UNITED STATES MINOR OUTLYING ISLANDS:581",\r
+  "WF" => "WALLIS AND FUTUNA ISLANDS:876",\r
+  \r
+  "AO" => "ANGOLA:024",\r
+  "BA" => "BOSNIA AND HERZEGOWINA:070",\r
+  "CU" => "CUBA:192",\r
+  "IR" => "ISLAMIC REPUBLIC OF IRAN:364",\r
+  "IQ" => "IRAQ:368",\r
+  "KP" => "DEMOCRATIC PEOPLES REPUBLIC OF KOREA:408",\r
+  "LY" => "LIBYAN ARAB JAMAHIRIYA:434",\r
+  "RW" => "RWANDA:646",\r
+  "GS" => "SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS:39",\r
+  "CD" => "DEMOCRATIC REPUBLIC OF THE CONGO:180",\r
+  "PS" => "OCCUPIED PALESTINIAN TERRITORY:275"\r
+);\r
+\r
+\r
+sub getCountry {\r
+  my $countryCode = shift; # give country code as an arguement to get country name\r
+  if(exists $CountryCodes::countryHash{$countryCode}){\r
+    my $countryName;\r
+    my $countryNumber;\r
+    ($countryName, $countryNumber) = split(/:/, $CountryCodes::countryHash{$countryCode});\r
+    return $countryName;\r
+  }\r
+  else { return undef }\r
+}\r
+\r
+sub getNumericCountryCode {\r
+  my $countryCode = shift; # give country code as an arguement to get numeric country code\r
+  if(exists $CountryCodes::countryHash{$countryCode}) {\r
+    my $countryName;\r
+    my $countryNumber;\r
+    ($countryName, $countryNumber) = split(/:/, $CountryCodes::countryHash{$countryCode});\r
+    return $countryNumber;\r
+  }\r
+  else {return undef}\r
+}\r
+\r
+\r
+sub isValidCountryCode {\r
+  my $countryCode = shift;\r
+  return (exists $CountryCodes::countryHash{$countryCode});\r
+}\r
+\r
+sub getCCodeFromCName {\r
+  my $country = shift; # give country name as an arguement to get country code\r
+  $country = uc($country);\r
+  my $key;\r
+  my $countryName;\r
+  my $countryNumber;\r
+  foreach $key (keys(%CountryCodes::countryHash)){\r
+    ($countryName, $countryNumber) = split(/:/, $CountryCodes::countryHash{$key});\r
+    if ($country  eq  $countryName) { return $key}\r
+  }\r
+  return undef;\r
+}\r
diff --git a/lib/Business/OnlinePayment/PPIPayMover/CreditCardRequest.pm b/lib/Business/OnlinePayment/PPIPayMover/CreditCardRequest.pm
new file mode 100644 (file)
index 0000000..8529489
--- /dev/null
@@ -0,0 +1,3182 @@
+package Business::OnlinePayment::PPIPayMover::CreditCardRequest;\r
+\r
+use strict;\r
+use vars qw(@ISA);\r
+use Business::OnlinePayment::PPIPayMover::TransactionRequest;\r
+use Business::OnlinePayment::PPIPayMover::CreditCardResponse;\r
+use Business::OnlinePayment::PPIPayMover::AdditionalField;\r
+use Business::OnlinePayment::PPIPayMover::constants;\r
+use Business::OnlinePayment::PPIPayMover::CountryCodes;\r
+use Business::OnlinePayment::PPIPayMover::URLEncoder;\r
+\r
+@ISA = qw(Business::OnlinePayment::PPIPayMover::TransactionRequest);\r
+1;\r
+\r
+#default constructor\r
+sub new {\r
+  my $class = shift;\r
+  my $self = $class->SUPER::new();\r
+\r
+# Misc identification fields\r
+  $self->{strCartridgeType}       = "";           # v1.5\r
+  $self->{strEcommerceIndicator}  = "";           # v1.5\r
+\r
+# credit card fields.\r
+  \r
+  $self->{strCreditCardNumber}    = "";\r
+  $self->{strCreditCardVerificationNumber} = "";  # v1.5\r
+  $self->{strAVSCode}             = "";           # v1.5\r
+  $self->{strExpireMonth}         = "";\r
+  $self->{strExpireYear}          = "";\r
+  $self->{strChargeType}          = "";\r
+  $self->{strChargeTotal}         = "";\r
+  $self->{dChargeTotal}           = -1.0;\r
+  $self->{strCardBrand}           = "";\r
+  $self->{strCurrency}            = "";\r
+  $self->{strOrderId}             = "";\r
+  $self->{strBankApprovalCode}    = ""; # Required if chargetype is FORCE_AUTH or FORCE_SALE\r
+  $self->{strDuplicateCheck}             = ""; #v1.7.1\r
+  $self->{strReferenceId}                              = "";   # Required if chargetype is CAPTURE, QUERY_CREDIT, QUERY_PAYMENT or ADJUSTMENT\r
+  $self->{strOrderDescription}    = "";\r
+  $self->{strOrderUserId}         = "";\r
+  $self->{strTaxAmount}           = "";\r
+  $self->{dTaxAmount}             = -1.0;\r
+  $self->{strShippingCharge}      = "";\r
+  $self->{dShippingCharge}        = -1.0;\r
+  \r
+#   Billing info fields ...\r
+  \r
+  $self->{strBillFirstName}       = "";\r
+  $self->{strBillLastName}        = "";\r
+  $self->{strBillMiddleName}      = "";\r
+  $self->{strBillCustomerTitle}   = "";\r
+  $self->{strBillCompany}         = "";\r
+  $self->{strBillAddressOne}      = "";\r
+  $self->{strBillAddressTwo}      = "";\r
+  $self->{strBillCity}            = "";\r
+  $self->{strBillStateOrProvince} = "";\r
+  $self->{strBillPostalCode}      = "";\r
+  $self->{strBillCountryCode}     = "";\r
+  $self->{strBillEmail}           = "";\r
+  $self->{strBillPhone}           = "";\r
+  $self->{strBillFax}             = "";\r
+  $self->{strBillNote}            = "";\r
+  \r
+# Shipping info fields default values.\r
+  \r
+  $self->{strShipFirstName}       = "";\r
+  $self->{strShipLastName}        = "";\r
+  $self->{strShipMiddleName}      = "";\r
+  $self->{strShipCustomerTitle}   = "";\r
+  $self->{strShipCompany}         = "";\r
+  $self->{strShipAddressOne}      = "";\r
+  $self->{strShipAddressTwo}      = "";\r
+  $self->{strShipCity}            = "";\r
+  $self->{strShipStateOrProvince} = "";\r
+  $self->{strShipPostalCode}      = "";\r
+  $self->{strShipCountryCode}     = "";\r
+  $self->{strShipEmail}           = "";\r
+  $self->{strShipPhone}           = "";\r
+  $self->{strShipFax}             = "";\r
+  $self->{strShipNote}            = "";\r
+  \r
+# Authentication fields\r
+  $self->{strAuthenticationTransactionId}       = "";\r
+  $self->{strAuthenticationPayload}            = "";\r
+  $self->{boolSuccessOnAuthenticationInconclusive}      = "";\r
+\r
+\r
+# Others\r
+  $self->{strBuyerCode}           = "";\r
+  $self->{strCAVV}                = "";\r
+  $self->{strCustomerIPAddress}   = "";\r
+  $self->{strPurchaseOrderNumber} = "";\r
+  $self->{dStateTax}              = -1.0;\r
+  $self->{strTrack1}              = "";\r
+  $self->{strTrack2}              = "";\r
+  $self->{strXID}                 = "";\r
+  $self->{boolTaxExempt}          = "";\r
+  $self->{strInvoiceNumber}       = "";\r
+  \r
+# Industry Fields\r
+  $self->{strIndustry}           = "";\r
+  $self->{strFolioNumber}        = "";\r
+  \r
+  $self->{boolChargeTotalIncludesRestaurant}     = "";\r
+  $self->{boolChargeTotalIncludesGiftshop}       = "";\r
+  $self->{boolChargeTotalIncludesMinibar}        = "";\r
+  $self->{boolChargeTotalIncludesPhone}          = "";\r
+  $self->{boolChargeTotalIncludesLaundry}        = "";\r
+  $self->{boolChargeTotalIncludesOther}          = "";\r
+  \r
+  $self->{dServiceRate}           = -1.0;\r
+  $self->{strServiceRate}           = "";\r
+  $self->{intServiceEndDay}      = "";\r
+  $self->{intServiceEndMonth}    = "";\r
+  $self->{intServiceEndYear}     = "";\r
+  $self->{intServiceStartDay}    = "";\r
+  $self->{intServiceStartMonth}          = "";\r
+  $self->{intServiceStartYear}   = "";\r
+  $self->{boolServiceNoShow}     = "";\r
+  \r
+  return $self;\r
+}\r
+\r
+\r
+\r
+#**\r
+# * Set the value of the cartridge type.\r
+# * <p>\r
+# */\r
+sub SetCartridgeType {\r
+  my $self = shift;\r
+  my $cartType = shift;  # take one string arguement to get cartridgeType\r
+  if (!defined($cartType)) {\r
+    $self->{strError} = "Cartridge type is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($cartType eq ""){\r
+    $self->{strError} = "Invalid cartridge type.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strCartridgeType} = $cartType;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the value of the Ecommerce Indicator number.\r
+# * <p>\r
+# */\r
+sub SetEcommerceIndicator {\r
+  my $self = shift;\r
+  my $ecommerceIndicator = shift;  # take one string arguement to get EcommerceIndicator\r
+  if (!defined($ecommerceIndicator)) {\r
+    $self->{strError} = "Ecommerce indicator is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($ecommerceIndicator eq ""){\r
+    $self->{strError} = "Invalid ecommerce indicator.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strEcommerceIndicator} = $ecommerceIndicator;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+\r
+\r
+#**\r
+# * Set the value of the credit card number.\r
+# * <p>\r
+# * @param creditCardNumber must be numeric characters\r
+# * @exception TransactionProtocolException thrown if creditCardNumber is non-numeric or the empty String.\r
+# */\r
+sub SetCreditCardNumber {\r
+  my $self = shift;\r
+  my $ccNo = shift;  # take one string arguement to get creditcard number\r
+  if (!defined($ccNo)) {\r
+    $self->{strError} = "Credit card number is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($ccNo eq ""){\r
+    $self->{strError} = "Invalid credit card number.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($ccNo =~ /\D/) {\r
+    $self->{strError} = "Non-numeric credit card number.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ( ( length $ccNo < 13 ) || ( length $ccNo > 19 ) ) {\r
+    $self->{strError} = "Invalid credit card number length.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strCreditCardNumber} = $ccNo;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#**\r
+# * Set the value of the credit card verification number.\r
+# * <p>\r
+# * @param creditCardVerificationNumber must be numeric characters\r
+# */\r
+sub SetCreditCardVerificationNumber {\r
+  my $self = shift;\r
+  my $ccVerNo = shift;  # take one string arguement to get creditCardVerification number\r
+  if (!defined($ccVerNo)) {\r
+    $self->{strError} = "Credit card verification number is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($ccVerNo eq ""){\r
+    $self->{strError} = "Invalid credit card verification number.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($ccVerNo =~ /\D/) {\r
+    $self->{strError} = "Non-numeric credit card verification number.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strCreditCardVerificationNumber} = $ccVerNo;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the value of the credit card expiration month.\r
+# * <p>\r
+# * @param expireMonth Must be an integer in ASCII characters in the range "1" to "12, inclusive.\r
+# * @exception TransactionProtocolException thrown if expireMonth is not >= 1 and <= 12.\r
+# */\r
+sub SetExpireMonth\r
+{\r
+  my $self = shift;\r
+  my $expireMonth = shift; #take one string arguement\r
+  if (!defined($expireMonth)) {\r
+    $self->{strError} = "Expire month is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($expireMonth eq ""){\r
+    $self->{strError} = "Invalid expire month.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  if ($expireMonth =~ /\D/) {\r
+    $self->{strError} = "Invalid credit expire month (non-digit).";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  my $iExpireMonth = 1 * $expireMonth;\r
+  if ($iExpireMonth < 1 || $iExpireMonth > 12) {\r
+    $self->{strError} .= "Invalid expire month (not 1 through 12).";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strExpireMonth} = $expireMonth;\r
+  \r
+  return 1;\r
+}\r
+\r
+\r
+#**\r
+# * Set the value of the credit card expiration year.\r
+# * <p>\r
+# * @param expireYear Must be a four-digit integer in ASCII characters. E.g. "2001".\r
+# * @exception TransactionProtocolException thrown if expireYear is not a four digit year.\r
+#\r
+sub SetExpireYear\r
+{\r
+  my $self = shift;\r
+  my $expireYear = shift; # take a string arguement\r
+  if (!defined($expireYear)) {\r
+    $self->{strError} = "Expire year is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if (length($expireYear) != 4) {\r
+    $self->{strError} = "Invalid expire year, must be 4 numeric characters.";\r
+    return CCR_ERROR;\r
+  }\r
+  if($expireYear =~ /\D/){\r
+    $self->{strError} = "Invalid credit expire year (non-numeric).";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  $self->{strExpireYear} = $expireYear;\r
+  return CCR_NO_ERROR;\r
+}\r
+#**\r
+# * Set the charge type.\r
+# * <p>\r
+# * @param chargeType Must be one of the following constants: SALE, AUTH, CAPTURE, FORCE_AUTH,\r
+# * FORCE_SALE, VOID, QUERY_CREDIT, QUERY_PAYMENT, ADJUSTMENT or CREDIT.\r
+# * @exception TransactionProtocolException thrown if chargeType is not a valid charge type\r
+# * defined by this class.\r
+# */\r
+sub SetChargeType\r
+{\r
+  my $self = shift;\r
+  my $chargeType = shift;  # take one string arguement\r
+  \r
+  if (!defined($chargeType)) {\r
+    $self->{strError} = "Charge type is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($chargeType eq "") {\r
+    $self->{strError} = "Invalid charge type";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  if (!($chargeType eq SALE || $chargeType eq AUTH || \r
+        $chargeType eq CAPTURE || $chargeType eq VOID ||\r
+        $chargeType eq FORCE_AUTH || $chargeType eq FORCE_SALE ||\r
+        $chargeType eq QUERY_PAYMENT || $chargeType eq QUERY_CREDIT ||\r
+        $chargeType eq CLOSE_ORDER || $chargeType eq CANCEL_ORDER ||\r
+        $chargeType eq VOID_AUTH || $chargeType eq VOID_CAPTURE ||\r
+        $chargeType eq VOID_CREDIT || $chargeType eq CREATE_ORDER ||\r
+        $chargeType eq CREDIT || $chargeType eq ADJUSTMENT)) {\r
+    $self->{strError} = "Invalid charge type.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strChargeType} = $chargeType;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the transaction amount using a floating point value.  Other amounts, such\r
+# * as tax amount or shipping charges, do not affect the charge total\r
+# * <p>\r
+# * @param chargeTotal Must be a positive floating-point number.\r
+# * E.g. Use <i>12.34</i> to represent $12.34.\r
+# * @exception TransactionProtocolException thrown if chargeTotal less than zero\r
+# */\r
+sub SetChargeTotal\r
+{\r
+  my $self = shift;\r
+  my $chargeTotal = shift; # take either one string  or float arguement\r
+  \r
+  if (!defined($chargeTotal)) {\r
+    $self->{strError} = "Charge total is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  if ( $chargeTotal !~ /^(\d+\.?\d*|\.\d+)$/ ) {\r
+    $self->{strError} = "Non-numeric charge.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  my $dChargeTotal = $chargeTotal * 1.0;\r
+  if ($dChargeTotal < 0){\r
+    $self->{strError} = "Charge total cannot be negative.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  $self->{dChargeTotal} = $dChargeTotal;\r
+  $self->{strChargeTotal} = "".$chargeTotal;\r
+  \r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+\r
+\r
+#**\r
+# * Set the transaction credit card brand.\r
+# * <p>\r
+# * @param cardBrand Must be one of the following constants:\r
+# *    VISA, MASTERCARD, AMERICAN_EXPRESS, DISCOVER, NOVA, AMEX, DINERS, EUROCARD,\r
+# *    CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_4, CARD_BRAND_5, or CARD_BRAND_6.\r
+# * @exception TransactionProtocolException thrown if cardBrand not one of the card brand constants\r
+# * defined by this class.\r
+# */\r
+sub SetCardBrand\r
+{\r
+  my $self = shift;\r
+  my $CardBrand = shift; # take a string arguement\r
+  \r
+  if (!defined($CardBrand) || $CardBrand eq ""){\r
+    $self->{strError} = "Blank or undefined card type.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  if ($CardBrand ne VISA &&\r
+    $CardBrand ne MASTERCARD &&\r
+    $CardBrand ne AMERICAN_EXPRESS &&\r
+    $CardBrand ne DISCOVER &&\r
+    $CardBrand ne NOVA &&\r
+    $CardBrand ne AMEX &&\r
+    $CardBrand ne DINERS &&\r
+    $CardBrand ne EUROCARD &&\r
+    $CardBrand ne CARD_BRAND_1 &&\r
+    $CardBrand ne CARD_BRAND_2 &&\r
+    $CardBrand ne CARD_BRAND_3 &&\r
+    $CardBrand ne CARD_BRAND_4 &&\r
+    $CardBrand ne CARD_BRAND_5 &&\r
+    $CardBrand ne CARD_BRAND_6) {\r
+    $self->{strError} = "Invalid card brand:$CardBrand.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strCardBrand} = $CardBrand;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#**\r
+# * Set the order ID.\r
+# */\r
+sub SetOrderId\r
+{\r
+  my $self = shift;\r
+  my $OrderId = shift; # take a string arguement\r
+  if (!defined($OrderId)) {\r
+    $self->{strError} = "Order id is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strOrderId} = $OrderId;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#**\r
+# * Set the capture reference ID (used in tracking captures / deposits).\r
+# * This field is required if chargeType is CAPTURE.\r
+# */\r
+sub SetCaptureReferenceId\r
+{\r
+  my $self = shift;\r
+  my $CaptureReferenceId = shift; #take a string arguement\r
+  if (!defined($CaptureReferenceId)){\r
+    $self->{strError} = "Capture reference id is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strReferenceId} = $CaptureReferenceId;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#\r
+# Set Reference Id\r
+# This should be used instead of SetCaptureReferenceId\r
+# Added in v1.6\r
+#\r
+sub SetReferenceId\r
+{\r
+  my $self = shift;\r
+  my $ReferenceId = shift; #take a string arguement\r
+  if (!defined($ReferenceId)){\r
+    $self->{strError} = "Reference id is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strReferenceId} = $ReferenceId;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#**\r
+# * Set a comment describing the order.\r
+# */\r
+sub SetOrderDescription\r
+{\r
+  my $self = shift;\r
+  my $OrderDescription = shift;  #take a string arguement\r
+  if (!defined($OrderDescription)) {\r
+    $self->{strError} = "Order description is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strOrderDescription} = $OrderDescription;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#/**\r
+# * Set the order's user id.  The order user id is an identifier\r
+# * for a merchant's customer.  It is not required, but may provide\r
+# * increased searching functionality in the merchant support center.\r
+# */\r
+sub SetOrderUserId\r
+{\r
+  my $self = shift;\r
+  my $OrderUserId = shift;  # take a string arguement\r
+  if (!defined($OrderUserId)) {\r
+    $self->{strError} = "Order user ID is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strOrderUserId} = $OrderUserId;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#**\r
+# * Set the bank approval code (used in force sale and force auth).\r
+# * This field is required if chargeType is FORCE_AUTH or FORCE_SALE.\r
+# */\r
+sub SetBankApprovalCode\r
+{\r
+  my $self = shift;\r
+  my $BankApprovalCode = shift; #take a string arguement\r
+  if (!defined($BankApprovalCode)){\r
+    $self->{strError} = "Bank Approval Code is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBankApprovalCode} = $BankApprovalCode;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#**\r
+# * Set the duplicate check.\r
+# * Possible values are CHECK, OVERRIDE, NO_CHECK\r
+# */\r
+sub SetDuplicateCheck\r
+{\r
+  my $self = shift;\r
+  my $DuplicateCheck = shift; #take a string arguement\r
+  if (!defined($DuplicateCheck)){\r
+    $self->{strError} = "Duplicate Check is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strDuplicateCheck} = $DuplicateCheck;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the tax amount using a floating point value.\r
+# * The tax amount is the amount of the chargeTotal that is tax.\r
+# * <p>\r
+# * @param taxAmount Must be a positive floating-point number.\r
+# * E.g. Use <i>11.55</i> to represent $11.55.\r
+# * @exception TransactionProtocolException thrown if taxAmount less than zero\r
+# */\r
+sub SetTaxAmount\r
+{\r
+  my $self = shift;\r
+  my $TaxAmount = shift; # take a string or an integer arguement\r
+  \r
+  if (!defined($TaxAmount)) {\r
+    $self->{strError} = "Tax amount is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ( $TaxAmount !~ /^(\d+\.?\d*|\.\d+)$/ ) {\r
+    $self->{strError} = "Non-numeric tax amount.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  my $dTaxAmount = $TaxAmount * 1.0;\r
+  if ($dTaxAmount < 0) {\r
+    $self->{strError} = "Tax amount cannot be negative.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  $self->{dTaxAmount} = $dTaxAmount;\r
+  $self->{strTaxAmount} = "".$TaxAmount;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the shipping charge using a floating point value.\r
+# * The shipping charge is the amount of the chargeTotal that is shipping charges.\r
+# * <p>\r
+# * @param shippingCharge Must be a positive floating-point number.\r
+# * E.g. Use <i>11.55</i> to represent $11.55.\r
+# * @exception TransactionProtocolException thrown if shippingCharge less than zero\r
+# */\r
+sub SetShippingCharge\r
+{\r
+  my $self = shift;\r
+  my $ShippingCharge = shift; # take a string or an integer arguement\r
+  \r
+  if (!defined($ShippingCharge)) {\r
+    $self->{strError} = "Shipping charge is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ( $ShippingCharge !~ /^(\d+\.?\d*|\.\d+)$/ ) {\r
+    $self->{strError} = "Non-numeric shipping charge.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  my $dShippingCharge = $ShippingCharge * 1.0;\r
+  if ($dShippingCharge < 0.00) {\r
+    $self->{strError} = "Shipping charge cannot be negative.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  $self->{dShippingCharge} = $dShippingCharge;\r
+  $self->{strShippingCharge} = "".$ShippingCharge;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the first name of the customer being billed.\r
+# */\r
+sub SetBillFirstName\r
+{\r
+  my $self = shift;\r
+  my $BillFirstName = shift; # take a string arguement\r
+  if (!defined($BillFirstName)) {\r
+    $self->{strError} = "Bill first name is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillFirstName} = $BillFirstName;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the last name of the customer being billed.\r
+# */\r
+sub SetBillLastName\r
+{\r
+  my $self = shift;\r
+  my $BillLastName = shift; # take a string arguement\r
+  if (!defined($BillLastName)) {\r
+    $self->{strError} = "Bill last name is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillLastName}  = $BillLastName;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the middle name of the customer being billed.\r
+#\r
+sub SetBillMiddleName\r
+{\r
+  my $self = shift;\r
+  my $BillMiddleName = shift; # take a string arguement\r
+  if (!defined($BillMiddleName)) {\r
+    $self->{strError} = "Bill middle name is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillMiddleName} = $BillMiddleName;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the title of the customer being billed, such as "Mr." or "Sales Manager".\r
+#/\r
+sub SetBillCustomerTitle\r
+{\r
+  my $self = shift;\r
+  my $BillCustomerTitle = shift; # take a string arguement\r
+  if (!defined($BillCustomerTitle)) {\r
+    $self->{strError} = "Bill customer title is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillCustomerTitle} = $BillCustomerTitle;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the name of the company of the customer being billed.\r
+# */\r
+sub SetBillCompany\r
+{\r
+  my $self = shift;\r
+  my $BillCompany = shift; # take a string arguement\r
+  if (!defined($BillCompany)) {\r
+    $self->{strError} = "Bill company is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillCompany} = $BillCompany;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the first part of the address of the customer being billed,\r
+# * such as "1455 Cedar Springs Drive".\r
+# */\r
+sub SetBillAddressOne\r
+{\r
+  my $self = shift;\r
+  my $BillAddressOne = shift; # take a string arguement\r
+  if (!defined($BillAddressOne)) {\r
+    $self->{strError} = "Bill address one  is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillAddressOne} = $BillAddressOne;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#*\r
+# * Set the second part of the address of the customer being billed,\r
+# * such as "Suite 100".\r
+# */\r
+sub SetBillAddressTwo\r
+{\r
+  my $self = shift;\r
+  my $BillAddressTwo = shift; # take a string arguement\r
+  if (!defined($BillAddressTwo)) {\r
+    $self->{strError} = "Bill address two is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillAddressTwo} = $BillAddressTwo;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the city of the customer being billed.\r
+# */\r
+sub SetBillCity\r
+{\r
+  my $self = shift;\r
+  my $BillCity = shift; # take a string arguement\r
+  if (!defined($BillCity)) {\r
+    $self->{strError} = "Bill city is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillCity} = $BillCity;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the state or province of the customer being billed.\r
+# */\r
+sub SetBillStateOrProvince\r
+{\r
+  my $self = shift;\r
+  my $BillStateOrProvince = shift; # take a string arguement\r
+  if (!defined($BillStateOrProvince)) {\r
+    $self->{strError} = "Bill state or province is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillStateOrProvince} = $BillStateOrProvince;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the postal code (or zip code) of the customer being billed.\r
+# */\r
+sub SetBillPostalCode\r
+{\r
+  my $self = shift;\r
+  my $BillPostalCode = shift; # take a string arguement\r
+  if (!defined($BillPostalCode)) {\r
+    $self->{strError} = "Bill postal code is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillPostalCode} = $BillPostalCode;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * @param billCountryCode     The alphabetic country code of the billing address.\r
+# * Must be a valid country code from ISO-3166. E.g. "CA" or "US".\r
+# * <p>\r
+# * @see com.paygateway.CountryCodes\r
+# * @exception TransactionProtocolException thrown if an invalid country code is passed in\r
+# */\r
+sub SetBillCountryCode\r
+{\r
+  my $self = shift;\r
+  my $BillCountryCode = shift; # take a string arguement (either country code or country name)\r
+  \r
+  if (!defined($BillCountryCode)) {\r
+    $self->{strError} = "Country code is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  my $CountryCode = getCCodeFromCName($BillCountryCode);\r
+  if (isValidCountryCode($BillCountryCode)) {\r
+    $self->{strBillCountryCode}  = $BillCountryCode;\r
+    return CCR_NO_ERROR;\r
+  }\r
+  elsif (defined($CountryCode))  {\r
+    $self->{strBillCountryCode} = $CountryCode;\r
+    return CCR_NO_ERROR;\r
+  }\r
+  else {\r
+    $self->{strError} = "Invalid country code for billing address.";\r
+    return CCR_ERROR;\r
+  }\r
+}\r
+\r
+\r
+#**\r
+# * Set the email address of the customer being billed.\r
+# */\r
+sub SetBillEmail\r
+{\r
+  my $self = shift;\r
+  my $BillEmail = shift;\r
+  if (!defined($BillEmail)) {\r
+    $self->{strError} = "Bill email is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($BillEmail !~ /.+@.+\..+/ ) {\r
+    $self->{strError} = "Invalid bill email format.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillEmail} = $BillEmail;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+#* Set the phone number\r
+#*/\r
+sub SetBillPhone\r
+{\r
+  my $self = shift;\r
+  my $BillPhone = shift; # take a string arguement\r
+  if (!defined($BillPhone)) {\r
+    $self->{strError} = "Bill phone is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillPhone} = $BillPhone;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the facsimile number of the customer being billed.\r
+# */\r
+sub SetBillFax\r
+{\r
+  my $self = shift;\r
+  my $BillFax = shift;\r
+  if (!defined($BillFax)) {\r
+    $self->{strError} = "Bill fax is undefined";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillFax} = $BillFax;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the billing note.  This a comment about the billing information.\r
+# */\r
+sub SetBillNote\r
+{\r
+  my $self = shift;\r
+  my $BillNote = shift; #take a string arguement\r
+  if (!defined($BillNote)) {\r
+    $self->{strError} = "Bill note is undefined";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBillNote} = $BillNote;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the first name for the shipping information.\r
+# */\r
+sub SetShipFirstName\r
+{\r
+  my $self = shift;\r
+  my $ShipFirstName = shift; # take a string arguement\r
+  if (!defined($ShipFirstName)) {\r
+    $self->{strError} = "Ship first name is undefined";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipFirstName} = $ShipFirstName;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the last name for the shipping information.\r
+# */\r
+sub SetShipLastName\r
+{\r
+  my $self = shift;\r
+  my $ShipLastName = shift;  # take a string arguement\r
+  if (!defined($ShipLastName)) {\r
+    $self->{strError} = "Ship last is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipLastName} = $ShipLastName;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the middle name for the shipping information.\r
+# */\r
+sub SetShipMiddleName\r
+{\r
+  my $self = shift;\r
+  my $ShipMiddleName = shift; # take a string arguement\r
+  \r
+  if (!defined($ShipMiddleName)) {\r
+    $self->{strError} = "Ship middle name is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipMiddleName} = $ShipMiddleName;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the customer title of the customer being jstrShipped to.\r
+# */\r
+sub SetShipCustomerTitle\r
+{\r
+  my $self = shift;\r
+  my $ShipCustomerTitle = shift; # take a string arguement\r
+  if (!defined($ShipCustomerTitle)) {\r
+    $self->{strError} = "Ship customer title is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipCustomerTitle} = $ShipCustomerTitle;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the company for the shipping information.\r
+# */\r
+sub SetShipCompany\r
+{\r
+  my $self = shift;\r
+  my $ShipCompany = shift; # take a string arguement\r
+  if (!defined($ShipCompany)) {\r
+    $self->{strError} = "Ship company is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipCompany} = $ShipCompany;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the first part of the shipping address, such as\r
+# * "485 Bridestone Way".\r
+# */\r
+sub SetShipAddressOne\r
+{\r
+  my $self = shift;\r
+  my $ShipAddressOne = shift; # take a string arguement\r
+  if (!defined($ShipAddressOne)) {\r
+    $self->{strError} = "Ship address is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipAddressOne} = $ShipAddressOne;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the second part of the shipping address, such as\r
+# * "Suite 234".\r
+\r
+sub SetShipAddressTwo\r
+{\r
+  my $self = shift;\r
+  my $ShipAddressTwo = shift; # take a string arguement\r
+  if (!defined($ShipAddressTwo)) {\r
+    $self->{strError} = "Ship address two is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipAddressTwo} = $ShipAddressTwo;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the city for the shipping address.\r
+# */\r
+sub SetShipCity\r
+{\r
+  my $self = shift;\r
+  my $ShipCity = shift; # take a string arguement\r
+  if (!defined($ShipCity)) {\r
+    $self->{strError} = "Ship city is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipCity} = $ShipCity;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the state or provicnce for the shipping address.\r
+# */\r
+sub SetShipStateOrProvince\r
+{\r
+  my $self = shift;\r
+  my $ShipStateOrProvince = shift; # take a string arguement\r
+  if (!defined($ShipStateOrProvince)) {\r
+    $self->{strError} = "Ship state or province is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipStateOrProvince} = $ShipStateOrProvince;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the postal code (or zip code) for the shipping address.\r
+# */\r
+sub SetShipPostalCode\r
+{\r
+  my $self = shift;\r
+  my $ShipPostalCode = shift; # take a string arguement\r
+  if (!defined($ShipPostalCode)) {\r
+    $self->{strError} = "Ship postal code is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipPostalCode} = $ShipPostalCode;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#**\r
+# * Set the shipping country code.\r
+# * @param shipCountryCode     The alphabetic country code of the billing address.\r
+# * Must be a valid country code from ISO-3166. E.g. "CA" or "US".\r
+# * <p>\r
+# * @see com.paygateway.CountryCodes\r
+# * @exception TransactionProtocolException thrown if an invalid country code is passed in\r
+# */\r
+sub SetShipCountryCode\r
+{\r
+  my $self = shift;\r
+  my $ShipCountryCode = shift; # take a string arguement (either country code or country name)\r
+  \r
+  if (!defined($ShipCountryCode)) {\r
+    $self->{strError} = "Ship country code is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  my $CountryCode = getCCodeFromCName($ShipCountryCode) ;\r
+  if (isValidCountryCode($ShipCountryCode)) {\r
+    $self->{strShipCountryCode}  = $ShipCountryCode;\r
+    return CCR_NO_ERROR;\r
+  }\r
+  elsif (defined($CountryCode))  {\r
+    $self->{strShipCountryCode} = $CountryCode;\r
+    return CCR_NO_ERROR;\r
+  }\r
+  else {\r
+    $self->{strError} = "Invalid country code for shipping address";\r
+    return CCR_ERROR;\r
+  }\r
+}\r
+\r
+\r
+#**\r
+# * Set the email address of the customer being shipped to.\r
+# */\r
+sub SetShipEmail\r
+{\r
+  my $self = shift;\r
+  my $ShipEmail = shift;  # take a string arguement\r
+  if (!defined($ShipEmail)) {\r
+    $self->{strError} = "Ship email is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipEmail} = $ShipEmail;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the phone number of the customer being shipped to.\r
+# */\r
+sub SetShipPhone\r
+{\r
+  my $self = shift;\r
+  my $ShipPhone = shift; # take a string arguement\r
+  if (!defined($ShipPhone)) {\r
+    $self->{strError} = "Ship phone is undefined";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipPhone} = $ShipPhone;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the facsimile number of the customer being shipped to.\r
+# */\r
+sub SetShipFax\r
+{\r
+  my $self = shift;\r
+  my $ShipFax = shift; # take a string arguement\r
+  if (!defined($ShipFax)) {\r
+    $self->{strError} = "Ship fax is undefined";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipFax} = $ShipFax;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set a note (comment) for the shipping information.\r
+# */\r
+sub SetShipNote\r
+{\r
+  my $self = shift;\r
+  my $ShipNote = shift;\r
+  if (!defined($ShipNote)) {\r
+    $self->{strError} = "Ship note is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strShipNote} = $ShipNote;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#/**\r
+# * Sets the currency\r
+# */\r
+sub SetCurrency\r
+{\r
+  my $self = shift;\r
+  my $Currency = shift;  # take a string arguement\r
+  if (!defined($Currency)) {\r
+    $self->{strError} = "Currency is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strCurrency} = $Currency;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the buyer code\r
+# */\r
+sub SetBuyerCode\r
+{\r
+  my $self = shift;\r
+  my $buyerCode = shift;  # take a string arguement\r
+  if (!defined($buyerCode)) {\r
+    $self->{strError} = "Buyer code is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strBuyerCode} = $buyerCode;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the CAVV (for VBV transactions)\r
+# */\r
+sub SetCAVV\r
+{\r
+  my $self = shift;\r
+  my $cavv = shift;  # take a string arguement\r
+  if (!defined($cavv)) {\r
+    $self->{strError} = "CAVV is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strCAVV} = $cavv;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the Customer IP Address\r
+# */\r
+sub SetCustomerIPAddress\r
+{\r
+  my $self = shift;\r
+  my $ip = shift;  # take a string arguement\r
+  if (!defined($ip)) {\r
+    $self->{strError} = "Customer IP address is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strCustomerIPAddress} = $ip;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the Order Customer ID\r
+# */\r
+sub SetOrderCustomerId\r
+{\r
+  my $self = shift;\r
+  my $orderCustomerID = shift;  # take a string arguement\r
+  if (!defined($orderCustomerID)) {\r
+    $self->{strError} = "Order customer ID is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strOrderCustomerID} = $orderCustomerID;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the purchase order number\r
+# */\r
+sub SetPurchaseOrderNumber\r
+{\r
+  my $self = shift;\r
+  my $purchaseOrderNumber = shift;  # take a string arguement\r
+  if (!defined($purchaseOrderNumber)) {\r
+    $self->{strError} = "Purchase order number is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strPurchaseOrderNumber} = $purchaseOrderNumber;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the state tax\r
+# */\r
+sub SetStateTax\r
+{\r
+  my $self = shift;\r
+  my $stateTax = shift;  # take a string arguement\r
+  if (!defined($stateTax)) {\r
+    $self->{strError} = "State tax is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+\r
+  if ( $stateTax !~ /^(\d+\.?\d*|\.\d+)$/ ) {\r
+    $self->{strError} = "Non-numeric state tax amount.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  $stateTax = $stateTax * 1.0;\r
+  if ($stateTax < 0) {\r
+    $self->{strError} = "State tax cannot be negative.";\r
+    return CCR_ERROR;\r
+  }\r
+\r
+  $self->{dStateTax} = $stateTax;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the track 1 data\r
+# */\r
+sub SetTrack1\r
+{\r
+  my $self = shift;\r
+  my $track1 = shift;  # take a string arguement\r
+  if (!defined($track1)) {\r
+    $self->{strError} = "Track 1 is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strTrack1} = $track1;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the track 2 data\r
+# */\r
+sub SetTrack2\r
+{\r
+  my $self = shift;\r
+  my $track2 = shift;  # take a string arguement\r
+  if (!defined($track2)) {\r
+    $self->{strError} = "Track 2 is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strTrack2} = $track2;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the transaction condition code\r
+# */\r
+sub SetTransactionConditionCode\r
+{\r
+  my $self = shift;\r
+  my $tcc = shift;  # take a string arguement\r
+  if (!defined($tcc)) {\r
+    $self->{strError} = "Transaction condition code is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strTransactionConditionCode} = $tcc;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the xid\r
+# */\r
+sub SetXID\r
+{\r
+  my $self = shift;\r
+  my $xid = shift;  # take a string arguement\r
+  if (!defined($xid)) {\r
+    $self->{strError} = "XID is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strXID} = $xid;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets tax exempt flag\r
+# */\r
+sub SetTaxExempt\r
+{\r
+  my $self = shift;\r
+  my $taxExempt = shift;  # take a string arguement\r
+  if (!defined($taxExempt)) {\r
+    $self->{strError} = "Tax exempt flag is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{boolTaxExempt} = $taxExempt;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets invoice number\r
+# */\r
+sub SetInvoiceNumber\r
+{\r
+  my $self = shift;\r
+  my $invoiceNumber = shift;  # take a string arguement\r
+  if (!defined($invoiceNumber)) {\r
+    $self->{strError} = "Invoice number is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strInvoiceNumber} = $invoiceNumber;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the Authentication Transaction ID\r
+# * \r
+# * Used in Payer Authentication transaction type\r
+# */\r
+sub SetAuthenticationTransactionId\r
+{\r
+  my $self = shift;\r
+  my $authenticationTransactionId = shift;  # take a string arguement\r
+  if (!defined($authenticationTransactionId)) {\r
+    $self->{strError} = "Authentication Transaction ID is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strAuthenticationTransactionId} = $authenticationTransactionId;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the Authentication Payload\r
+# * \r
+# * Used in Payer Authentication transaction type\r
+# */\r
+sub SetAuthenticationPayload\r
+{\r
+  my $self = shift;\r
+  my $authenticationPayload = shift;  # take a string arguement\r
+  if (!defined($authenticationPayload)) {\r
+    $self->{strError} = "Authentication Payload is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strAuthenticationPayload} = $authenticationPayload;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the Success On Authentication Inconclusive\r
+# * \r
+# * Used in Payer Authentication transaction type\r
+# */\r
+sub SetDoTransactionOnAuthenticationInconclusive\r
+{\r
+  my $self = shift;\r
+  my $successOnAuthenticationInconclusive = shift;  # take a string arguement\r
+  if (!defined($successOnAuthenticationInconclusive)) {\r
+    $self->{strError} = "Success on authentication inconclusive is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{boolSuccessOnAuthenticationInconclusive} = $successOnAuthenticationInconclusive;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the Industry type.\r
+# * <p>\r
+# * @param industry Must be one of the following constants: DIRECT_MARKETING, RETAIL, LODGING, RESTAURANT.\r
+# * @exception TransactionProtocolException thrown if industry is not a valid charge type\r
+# * defined by this class.\r
+# */\r
+sub SetIndustry\r
+{\r
+  my $self = shift;\r
+  my $industry = shift;  # take one string arguement\r
+  \r
+  if (!defined($industry)) {\r
+    $self->{strError} = "Industry is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($industry eq "") {\r
+    $self->{strError} = "Invalid industry";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  if (!($industry eq DIRECT_MARKETING ||\r
+       $industry eq RETAIL || \r
+        $industry eq LODGING ||\r
+        $industry eq RESTAURANT )) {\r
+    $self->{strError} = "Invalid industry.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strIndustry} = $industry;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#/**\r
+# * Sets folio number\r
+# */\r
+sub SetFolioNumber\r
+{\r
+  my $self = shift;\r
+  my $folioNumber = shift;  # take a string arguement\r
+  if (!defined($folioNumber)) {\r
+    $self->{strError} = "Folio number is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{strFolioNumber} = $folioNumber;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+\r
+#**\r
+# * Set the service rate using a floating point value.\r
+# * <p>\r
+# * @param ServiceRate Must be a positive floating-point number.\r
+# * E.g. Use <i>11.55</i> to represent $11.55.\r
+# * @exception TransactionProtocolException thrown if ServiceRate less than zero\r
+# */\r
+sub SetServiceRate\r
+{\r
+  my $self = shift;\r
+  my $ServiceRate = shift; # take a string or an integer arguement\r
+  \r
+  if (!defined($ServiceRate)) {\r
+    $self->{strError} = "Service rate is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ( $ServiceRate !~ /^(\d+\.?\d*|\.\d+)$/ ) {\r
+    $self->{strError} = "Non-numeric Service Rate.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  my $dServiceRate = $ServiceRate * 1.0;\r
+  if ($dServiceRate < 0) {\r
+    $self->{strError} = "Service rate cannot be negative.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  $self->{dServiceRate} = $dServiceRate;\r
+  $self->{strServiceRate} = "".$ServiceRate;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * Set the service end day\r
+# */  \r
+sub SetServiceEndDay\r
+{\r
+  my $self = shift;\r
+  my $serviceEndDay = shift; #take one string arguement\r
+  if (!defined($serviceEndDay)) {\r
+    $self->{strError} = "Service end day is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($serviceEndDay eq ""){\r
+    $self->{strError} = "Invalid service end day.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  if ($serviceEndDay =~ /\D/) {\r
+    $self->{strError} = "Invalid service end day (non-digit).";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  $serviceEndDay = 1 * $serviceEndDay;\r
+  if ($serviceEndDay < 1 || $serviceEndDay > 31) {\r
+    $self->{strError} .= "Invalid service end day (not 1 through 31).";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{intServiceEndDay} = $serviceEndDay;\r
+  \r
+  return 1;\r
+}  \r
+\r
+  \r
+#**\r
+# * Set the service end month\r
+# */  \r
+sub SetServiceEndMonth\r
+{\r
+  my $self = shift;\r
+  my $serviceEndMonth = shift; #take one string arguement\r
+  if (!defined($serviceEndMonth)) {\r
+    $self->{strError} = "Service end month is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($serviceEndMonth eq ""){\r
+    $self->{strError} = "Invalid service end month.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  if ($serviceEndMonth =~ /\D/) {\r
+    $self->{strError} = "Invalid service end month (non-digit).";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  $serviceEndMonth = 1 * $serviceEndMonth;\r
+  if ($serviceEndMonth < 1 || $serviceEndMonth > 12) {\r
+    $self->{strError} .= "Invalid service end month (not 1 through 12).";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{intServiceEndMonth} = $serviceEndMonth;\r
+  \r
+  return 1;\r
+}   \r
+  \r
+#**\r
+# * Set the service end year\r
+# */  \r
+sub SetServiceEndYear\r
+{\r
+  my $self = shift;\r
+  my $serviceEndYear = shift; #take one string arguement\r
+  if (!defined($serviceEndYear)) {\r
+    $self->{strError} = "Service end year is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($serviceEndYear eq ""){\r
+    $self->{strError} = "Invalid service end year.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  if ($serviceEndYear =~ /\D/) {\r
+    $self->{strError} = "Invalid service end year (non-digit).";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  $serviceEndYear = 1 * $serviceEndYear;\r
+  if ($serviceEndYear < 2005 || $serviceEndYear > 9999) {\r
+    $self->{strError} .= "Invalid service end year.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{intServiceEndYear} = $serviceEndYear;\r
+  \r
+  return 1;\r
+}  \r
+\r
+\r
+#**\r
+# * Set the service start day\r
+# */  \r
+sub SetServiceStartDay\r
+{\r
+  my $self = shift;\r
+  my $serviceStartDay = shift; #take one string arguement\r
+  if (!defined($serviceStartDay)) {\r
+    $self->{strError} = "Service start day is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($serviceStartDay eq ""){\r
+    $self->{strError} = "Invalid service start day.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  if ($serviceStartDay =~ /\D/) {\r
+    $self->{strError} = "Invalid service start day (non-digit).";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  $serviceStartDay = 1 * $serviceStartDay;\r
+  if ($serviceStartDay < 1 || $serviceStartDay > 31) {\r
+    $self->{strError} .= "Invalid service start day (not 1 through 31).";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{intServiceStartDay} = $serviceStartDay;\r
+  \r
+  return 1;\r
+}  \r
+\r
+  \r
+#**\r
+# * Set the service start month\r
+# */  \r
+sub SetServiceStartMonth\r
+{\r
+  my $self = shift;\r
+  my $serviceStartMonth = shift; #take one string arguement\r
+  if (!defined($serviceStartMonth)) {\r
+    $self->{strError} = "Service start month is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($serviceStartMonth eq ""){\r
+    $self->{strError} = "Invalid service start month.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  if ($serviceStartMonth =~ /\D/) {\r
+    $self->{strError} = "Invalid service start month (non-digit).";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  $serviceStartMonth = 1 * $serviceStartMonth;\r
+  if ($serviceStartMonth < 1 || $serviceStartMonth > 12) {\r
+    $self->{strError} .= "Invalid service start month (not 1 through 12).";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{intServiceStartMonth} = $serviceStartMonth;\r
+  \r
+  return 1;\r
+}   \r
+  \r
+#**\r
+# * Set the service start year\r
+# */  \r
+sub SetServiceStartYear\r
+{\r
+  my $self = shift;\r
+  my $serviceStartYear = shift; #take one string arguement\r
+  if (!defined($serviceStartYear)) {\r
+    $self->{strError} = "Service start year is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  if ($serviceStartYear eq ""){\r
+    $self->{strError} = "Invalid service start year.";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  if ($serviceStartYear =~ /\D/) {\r
+    $self->{strError} = "Invalid service start year (non-digit).";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  $serviceStartYear = 1 * $serviceStartYear;\r
+  if ($serviceStartYear < 2005 || $serviceStartYear > 9999) {\r
+    $self->{strError} .= "Invalid service start year.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{intServiceStartYear} = $serviceStartYear;\r
+  \r
+  return 1;\r
+}  \r
+\r
+\r
+\r
+#/**\r
+# * Sets the Charge Total Includes Restaurant flag\r
+# * \r
+# */\r
+sub SetChargeTotalIncludesRestaurant\r
+{\r
+  my $self = shift;\r
+  my $isChargeTotalIncludesRestaurant = shift;  # take a string arguement\r
+  if (!defined($isChargeTotalIncludesRestaurant)) {\r
+    $self->{strError} = "Charge Total Includes Restaurant is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{boolChargeTotalIncludesRestaurant} = $isChargeTotalIncludesRestaurant;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the Charge Total Includes Giftshop flag\r
+# * \r
+# */\r
+sub SetChargeTotalIncludesGiftshop\r
+{\r
+  my $self = shift;\r
+  my $isChargeTotalIncludesGiftshop = shift;  # take a string arguement\r
+  if (!defined($isChargeTotalIncludesGiftshop)) {\r
+    $self->{strError} = "Charge Total Includes Giftshop is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{boolChargeTotalIncludesGiftshop} = $isChargeTotalIncludesGiftshop;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the Charge Total Includes Minibar flag\r
+# * \r
+# */\r
+sub SetChargeTotalIncludesMinibar\r
+{\r
+  my $self = shift;\r
+  my $isChargeTotalIncludesMinibar = shift;  # take a string arguement\r
+  if (!defined($isChargeTotalIncludesMinibar)) {\r
+    $self->{strError} = "Charge Total Includes Minibar is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{boolChargeTotalIncludesMinibar} = $isChargeTotalIncludesMinibar;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the Charge Total Includes Phone flag\r
+# * \r
+# */\r
+sub SetChargeTotalIncludesPhone\r
+{\r
+  my $self = shift;\r
+  my $isChargeTotalIncludesPhone = shift;  # take a string arguement\r
+  if (!defined($isChargeTotalIncludesPhone)) {\r
+    $self->{strError} = "Charge Total Includes Phone is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{boolChargeTotalIncludesPhone} = $isChargeTotalIncludesPhone;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the Charge Total Includes Laundry flag\r
+# * \r
+# */\r
+sub SetChargeTotalIncludesLaundry\r
+{\r
+  my $self = shift;\r
+  my $isChargeTotalIncludesLaundry = shift;  # take a string arguement\r
+  if (!defined($isChargeTotalIncludesLaundry)) {\r
+    $self->{strError} = "Charge Total Includes Laundry is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{boolChargeTotalIncludesLaundry} = $isChargeTotalIncludesLaundry;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the Charge Total Includes Other flag\r
+# * \r
+# */\r
+sub SetChargeTotalIncludesOther\r
+{\r
+  my $self = shift;\r
+  my $isChargeTotalIncludesOther = shift;  # take a string arguement\r
+  if (!defined($isChargeTotalIncludesOther)) {\r
+    $self->{strError} = "Charge Total Includes Other is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{boolChargeTotalIncludesOther} = $isChargeTotalIncludesOther;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#/**\r
+# * Sets the Service No Show flag\r
+# * \r
+# */\r
+sub SetServiceNoShow\r
+{\r
+  my $self = shift;\r
+  my $isServiceNoShow = shift;  # take a string arguement\r
+  if (!defined($isServiceNoShow)) {\r
+    $self->{strError} = "Service No Show is undefined.";\r
+    return CCR_ERROR;\r
+  }\r
+  $self->{boolServiceNoShow} = $isServiceNoShow;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+\r
+#/////////////////////////////////////////////////////////////////////////////////////////////////////\r
+#// Get Methods.\r
+#\r
+\r
+#/**\r
+# * Get the cartridge type.\r
+# * @returns the type of cartridge being used\r
+# */\r
+sub GetCartridgeType\r
+{\r
+  my $self = shift;\r
+  $self->{strCartridgeType};\r
+}\r
+\r
+#/**\r
+# * Get the Ecommerce Indicator\r
+# * @returns the Ecommerce Indicator\r
+# */\r
+sub GetEcommerceIndicator\r
+{\r
+  my $self = shift;\r
+  $self->{strEcommerceIndicator};\r
+}\r
+\r
+#/**\r
+# * Get the value of the credit card number.\r
+# * @see #setCreditCardNumber(JString)\r
+# * @return the value of the credit card number or an empty String if the credit card number was not set\r
+# */\r
+sub GetCreditCardNumber\r
+{\r
+  my $self = shift;\r
+  $self->{strCreditCardNumber};\r
+}\r
+\r
+#/**\r
+# * Get the value of the credit card number.\r
+# * @return the value of the credit card verification number or an empty String if the credit card number was not set\r
+# */\r
+sub GetCreditCardVerificationNumber\r
+{\r
+  my $self = shift;\r
+  $self->{strCreditCardVerificationNumber};\r
+}\r
+\r
+#**\r
+# * Get the value of the credit card's expire year.\r
+# * @see #setExpireYear(JString)\r
+# * @return the String passed to setExpireYear or an empty String if the expire year was not set\r
+# */\r
+sub GetExpireYear\r
+{\r
+  my $self = shift;\r
+  $self->{strExpireYear};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the credit card's expire month.\r
+# * @see #setExpireMonth(String)\r
+# * @return the String passed to setExpireMonth or an empty String if the expire month was not set\r
+# */\r
+sub GetExpireMonth\r
+{\r
+  my $self = shift;\r
+  $self->{strExpireMonth};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the charge type.  The possible values are defined\r
+# * by the constants of this class documented in setChargeType(String)\r
+# * The chage type indicates what action to take with this credit card\r
+# * transaction.\r
+# * @see #setChargeType(String)\r
+# * @return the String passed to setChargeType or an empty String if the charge type was not set\r
+#\r
+sub GetChargeType()\r
+{\r
+  my $self = shift;\r
+  $self->{strChargeType};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the charge total.  The charge total is the amount that\r
+# * will be used for this credit card transaction.\r
+# * @see #setChargeTotal(double)\r
+# * @see #setChargeTotal(String)\r
+# * @return the value of the charge total or -1 if the charge total was not set\r
+#\r
+sub GetChargeTotal\r
+{\r
+  my $self = shift;\r
+  $self->{dChargeTotal};\r
+}\r
+\r
+sub GetChargeTotalStr\r
+{\r
+  my $self = shift;\r
+  $self->{strChargeTotal};\r
+}\r
+\r
+#**\r
+# * Get the value of the card brand.  The card brand identifies the type\r
+# * of card being used.  The card brand must be one of the constants defined\r
+# * by this class and documented in setCardBrand(JString)\r
+# * @see #setCardBrand(JString)\r
+# * @return the value of the card brand or an empty String if the card brand was not set\r
+#/\r
+sub GetCardBrand\r
+{\r
+  my $self = shift;\r
+  $self->{strCardBrand};\r
+}\r
+\r
+#**\r
+# * Get the value of the order id.  The order id must be a unique identifier\r
+# * for a paticular order.\r
+# * @see #setOrderId(JString)\r
+# * @return the value of the order id or an empty String if the order id was not set\r
+# */\r
+sub GetOrderId\r
+{\r
+  my $self = shift;\r
+  $self->{strOrderId};\r
+}\r
+\r
+\r
+\r
+#**\r
+# * Get the value of the capture reference id.  The capture reference id is the\r
+# * value returned from an "AUTH" credit card transaction that must be presented\r
+# * when to the "CAPTURE" for that order.\r
+# * @see #setCaptureReferenceId(JString)\r
+# * @return the value of the capture reference id or an empty String if the capture reference id was not set\r
+#\r
+sub GetCaptureReferenceId\r
+{\r
+  my $self = shift;\r
+  $self->{strReferenceId};\r
+}\r
+\r
+#\r
+# Get Reference Id\r
+# This should be used instead of GetCaptureReferenceId\r
+# Added in v1.6\r
+#\r
+sub GetReferenceId\r
+{\r
+  my $self = shift;\r
+  $self->{strReferenceId};\r
+}\r
+\r
+#/**\r
+# * Get the value of the order description.  The order description is a comment\r
+# * that describes the order.\r
+# * @see #setOrderDescription(JString)\r
+# * @return the value of the order description or an empty String if the order description was not set\r
+#/\r
+sub GetOrderDescription\r
+{\r
+  my $self = shift;\r
+  $self->{strOrderDescription};\r
+}\r
+\r
+#**\r
+# * Get the value of the order user id.  The order user id is a unique identifier\r
+# * for a merchant's customer.\r
+# * @see #setOrderUserId(String)\r
+# * @return the value of the order user id of an empty String if order user id was not set\r
+#\r
+sub GetOrderUserId\r
+{\r
+  my $self = shift;\r
+  $self->{strOrderUserId};\r
+}\r
+\r
+#**\r
+# * Get the value of the duplicate check.  \r
+# * Possible values are: CHECK; OVERRIDE; NO_CHECK.\r
+# * @see #setDuplicateCheck(String)\r
+# * @return the value of the duplicate check or an empty String if the dc was not set\r
+#\r
+sub GetDuplicateCheck\r
+{\r
+  my $self = shift;\r
+  $self->{strDuplicateCheck};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the bank approval code.  The bank approval code is the\r
+# * value required for a "FORCE_AUTH" or "FORCE_SALE" credit card transaction.\r
+# * It is obtained offline via a phone call to the merchant's bank 'voice auth' \r
+# * phone number.  The card holder is not present in this type of transaction.\r
+# * @see #setBankApprovalCode(String)\r
+# * @return the value of the bank approval code or an empty String if the bac was not set\r
+#\r
+sub GetBankApprovalCode\r
+{\r
+  my $self = shift;\r
+  $self->{strBankApprovalCode};\r
+}\r
+\r
+\r
+#**\r
+# * The tax amount is the amount of the the charge total that is tax.\r
+# * @see #setTaxAmount\r
+# * @see #setChargeTotal\r
+# * @return value of the tax amount of -1 if the tax amount has not been set.\r
+#\r
+sub GetTaxAmount\r
+{\r
+  my $self = shift;\r
+  $self->{dTaxAmount};\r
+}\r
+\r
+sub GetTaxAmountStr\r
+{\r
+  my $self = shift;\r
+  $self->{strTaxAmount};\r
+}\r
+\r
+\r
+#**\r
+# * The shipping charge is the amount of the charge total that is shipping charges.\r
+# * @see #setShippingCharge\r
+# * @see #setChargeTotal\r
+# * @return value of the shipping charge or -1 if the shipping charge has not been set\r
+# */\r
+sub GetShippingCharge\r
+{\r
+  my $self = shift;\r
+  $self->{dShippingCharge};\r
+}\r
+\r
+sub GetShippingChargeStr\r
+{\r
+  my $self = shift;\r
+  $self->{strShippingCharge};\r
+}\r
+\r
+\r
+#/**\r
+# * Get the value of the first name of the customer being billed.\r
+# * @see #setBillFirstName(JString)\r
+# * @return the billing first name or an empty String if the billing first name was not set\r
+# */\r
+sub GetBillFirstName\r
+{\r
+  my $self = shift;\r
+  $self->{strBillFirstName};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the last name of the customer being billed.\r
+# * @see #setBillLastName(String)\r
+# * return the billing last name or an empty String if the billing last name was not set\r
+# */\r
+sub GetBillLastName\r
+{\r
+  my $self = shift;\r
+  $self->{strBillLastName};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the middle name of the customer being billed.\r
+# * @see #setBillMiddleName(JString)\r
+# * @return the billing middle name or an empty String if the billing middle name was not set\r
+# */\r
+sub GetBillMiddleName\r
+{\r
+  my $self = shift;\r
+  $self->{strBillMiddleName};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the title of the customer being billed.\r
+# * @see #setBillCustomerTitle(JString)\r
+# * @return the billing customer title or an empty String if billing customer title was not set\r
+# */\r
+sub GetBillCustomerTitle\r
+{\r
+  my $self = shift;\r
+  $self->{strBillCustomerTitle};\r
+}\r
+\r
+#**\r
+# * Get the value of the company name of the customer being billed.\r
+# * @see #setBillCompany(JString)\r
+# * @return the billing company name or an empty String if the billing company name was not set\r
+#\r
+sub GetBillCompany\r
+{\r
+  my $self = shift;\r
+  $self->{strBillCompany};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the first part of the billing address.\r
+# * @see #setBillAddressOne(JString)\r
+# * @return the first part of the billing address or an empty String if the billing address part one was not set\r
+# */\r
+sub GetBillAddressOne\r
+{\r
+  my $self = shift;\r
+  $self->{strBillAddressOne};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the second part of the billing address.\r
+# * @see #setBillAddressTwo(JString)\r
+# * @return the second part of the billing address or an empty String if the billing address part two was not set\r
+# */\r
+sub GetBillAddressTwo\r
+{\r
+  my $self = shift;\r
+  $self->{strBillAddressTwo};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the city for the billing address.\r
+# * @see #setBillCity(JString)\r
+# * @return the billing address city or an empty String if the billing city was not set\r
+# */\r
+sub GetBillCity\r
+{\r
+  my $self = shift;\r
+  $self->{strBillCity};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the state or province for the billing address.\r
+# * @see #setBillStateOrProvince(String)\r
+# * @return the billing address state or province or an empty String if billing state or province was not set\r
+# */\r
+sub GetBillStateOrProvince\r
+{\r
+  my $self = shift;\r
+  $self->{strBillStateOrProvince};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the postal code for the billing address.\r
+# * @see #setBillPostalCode(String)\r
+# * @return the billing address postal code or an empty String if billing postal code was not set\r
+#*/\r
+sub GetBillPostalCode\r
+{\r
+  my $self = shift;\r
+  $self->{strBillPostalCode};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the country for the billing address.\r
+# * @see #setBillCountryCode(JString)\r
+# * @return the billing country or an empty String if the billing country was not set\r
+#\r
+sub GetBillCountryCode\r
+{\r
+  my $self = shift;\r
+  $self->{strBillCountryCode};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the email address of the customer being billed.\r
+# * @see #setBillEmail(JString)\r
+# * @return the billing email address or an empty String if the billing email was not set\r
+#\r
+sub GetBillEmail\r
+{\r
+  my $self = shift;\r
+  $self->{strBillEmail};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the phone number of the customer being billed.\r
+# * @see #setBillPhone(JString)\r
+# * @return the billing phone number or an empty String if the billing phone number was not set\r
+# */\r
+sub GetBillPhone\r
+{\r
+  my $self = shift;\r
+  $self->{strBillPhone};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the fax number of the customer being billed.\r
+# * @see #setBillFax(JString)\r
+# * @return the billing fax number or an empty String if the billing fax number was not set\r
+# */\r
+sub GetBillFax\r
+{\r
+  my $self = shift;\r
+  $self->{strBillFax};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the billing note.  The billing note is an extra\r
+# * comment to the billing information.\r
+# * @see #setBillNote(JString)\r
+# * @return the billing note or an empty String if the billing not was not set\r
+#\r
+sub GetBillNote\r
+{\r
+  my $self = shift;\r
+  $self->{strBillNote};\r
+}\r
+\r
+#**\r
+# * Get the value of the first name of the customer being shipped to.\r
+# * @see #setShipFirstName(JString)\r
+# * @return the shipping first name or an empty String if the shipping first name was not set\r
+#\r
+sub GetShipFirstName\r
+{\r
+  my $self = shift;\r
+  $self->{strShipFirstName};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the last name of the customer being shipped to.\r
+# * @see #setShipLastName(JString)\r
+# * @return the shipping last name or an empty String if the shipping last name was not set\r
+# */\r
+sub GetShipLastName\r
+{\r
+  my $self = shift;\r
+  $self->{strShipLastName};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the middle name of the customer being shipped to.\r
+# * @see #setShipMiddleName(JString)\r
+# * @return the shipping middle name or an empty String if the shipping middle name was not set\r
+# */\r
+sub GetShipMiddleName\r
+{\r
+  my $self = shift;\r
+  $self->{strShipMiddleName};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the title of the customer being shipped to.\r
+# * @see #setShipCustomerTitle(String)\r
+# * @return the shipping customer title or an empty String if the shipping customer title was not set\r
+#\r
+sub GetShipCustomerTitle\r
+{\r
+  my $self = shift;\r
+  $self->{strShipCustomerTitle};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the company name of the customer being shipped to.\r
+# * @see #setShipCompany(JString)\r
+# * @return the shipping company name or an empty String if the shipping company name was not set\r
+# */\r
+sub GetShipCompany\r
+{\r
+  my $self = shift;\r
+  $self->{strShipCompany};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the first part of the shipping address.\r
+# * @see #setShipAddressOne(JString)\r
+# * @return the first part of the shipping address or an empty String if the shipping address part one was not set\r
+# */\r
+sub GetShipAddressOne\r
+{\r
+  my $self = shift;\r
+  $self->{strShipAddressOne};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the second part of the shipping address.\r
+# * @see #setShipAddressTwo(JString)\r
+# * @return the second part of the shipping address or an empty String if the shipping address part two was not set\r
+#\r
+sub GetShipAddressTwo\r
+{\r
+  my $self = shift;\r
+  $self->{strShipAddressTwo};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the city for the shipping address.\r
+# * @see #setShipCity(JString)\r
+# * @return the shipping address city or an empty String if the shipping city was not set\r
+#\r
+sub GetShipCity\r
+{\r
+  my $self = shift;\r
+  $self->{strShipCity};\r
+}\r
+\r
+#**\r
+# * Get the value of the state or province for the shipping address.\r
+# * @see #setShipStateOrProvince(JString)\r
+# * @return the shipping address state or province or an empty String if the shipping state or provice was not set\r
+# */\r
+sub GetShipStateOrProvince\r
+{\r
+  my $self = shift;\r
+  $self->{strShipStateOrProvince};\r
+}\r
+\r
+\r
+#*\r
+# * Get the value of the postal code for the shipping address.\r
+# * @see #setShipPostalCode(JString)\r
+# * @return the shipping address postal code or an empty String if the shipping postal code was not set\r
+# */\r
+sub GetShipPostalCode\r
+{\r
+  my $self = shift;\r
+  $self->{strShipPostalCode};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the country for the shipping address.\r
+# * @see #setShipCountryCode(JString)\r
+# * @return the shipping country or an empty String if the shipping country was not set\r
+# */\r
+sub GetShipCountryCode\r
+{\r
+  my $self = shift;\r
+  $self->{strShipCountryCode};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the email address of the customer being shipped to.\r
+# * @see #setShipEmail(JString)\r
+# * @return the shipping email address or an empty String if the shipping customer email address was not set\r
+# */\r
+sub GetShipEmail\r
+{\r
+  my $self = shift;\r
+  $self->{strShipEmail};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the phone number of the customer being shipped to.\r
+# * @see #setShipPhone(JString)\r
+# * @return the shipping phone number or an empty String if the shipping customer phone number was not set\r
+# */\r
+sub GetShipPhone\r
+{\r
+  my $self = shift;\r
+  $self->{strShipPhone};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the fax number of the customer being shipped to.\r
+# * @see #setShipFax(JString)\r
+# * @return the shipping fax number or an empty JString if the shipping customer fax number was not set\r
+# */\r
+sub GetShipFax\r
+{\r
+  my $self = shift;\r
+  $self->{strShipFax};\r
+}\r
+\r
+\r
+#**\r
+# * Get the value of the shipping note.  The shipping note is an extra\r
+# * comment to the shipping information.\r
+# * @see #setShipNote(JString)\r
+# * @return the shipping note or an empty String if the shipping note was not set\r
+# */\r
+sub GetShipNote\r
+{\r
+  my $self = shift;\r
+  $self->{strShipNote};\r
+}\r
+\r
+\r
+#**\r
+# * Method to get a CreditCardResponse object.\r
+# */\r
+sub GetTransResponseObject\r
+{\r
+  my $self = shift;\r
+  my $InString = shift;\r
+  return new Business::OnlinePayment::PPIPayMover::CreditCardResponse($InString);\r
+}\r
+\r
+\r
+#/**\r
+# * Get the value of the currency.  The currency that\r
+# * will be used for this transaction. If the merchant\r
+# * does not have an account configured to process this currency, the\r
+# * Transaction Server will return an error.\r
+# * @see #setCurrency(String) \r
+# * @return the currency or "" if the currency was not set\r
+# */\r
+sub GetCurrency\r
+{\r
+  my $self = shift;\r
+  $self->{strCurrency};\r
+}\r
+\r
+\r
+#/**\r
+# * Gets the buyer code\r
+# */\r
+sub GetBuyerCode\r
+{\r
+  my $self = shift;\r
+  $self->{strBuyerCode};\r
+}\r
+\r
+#/**\r
+# * Gets the CAVV (for VBV transactions)\r
+# */\r
+sub GetCAVV\r
+{\r
+  my $self = shift;\r
+  $self->{strCAVV};\r
+}\r
+\r
+#/**\r
+# * Gets the Customer IP Address\r
+# */\r
+sub GetCustomerIPAddress\r
+{\r
+  my $self = shift;\r
+  $self->{strCustomerIPAddress};\r
+}\r
+\r
+#/**\r
+# * Gets the Order Customer ID\r
+# */\r
+sub GetOrderCustomerId\r
+{\r
+  my $self = shift;\r
+  $self->{strOrderCustomerID};\r
+}\r
+\r
+#/**\r
+# * Gets the purchase order number\r
+# */\r
+sub GetPurchaseOrderNumber\r
+{\r
+  my $self = shift;\r
+  $self->{strPurchaseOrderNumber};\r
+}\r
+\r
+#/**\r
+# * Gets the state tax\r
+# */\r
+sub GetStateTax\r
+{\r
+  my $self = shift;\r
+  $self->{dStateTax};\r
+}\r
+\r
+#/**\r
+# * Gets the track 1 data\r
+# */\r
+sub GetTrack1\r
+{\r
+  my $self = shift;\r
+  $self->{strTrack1};\r
+}\r
+\r
+#/**\r
+# * Gets the track 2 data\r
+# */\r
+sub GetTrack2\r
+{\r
+  my $self = shift;\r
+  $self->{strTrack2};\r
+}\r
+\r
+#/**\r
+# * Gets the transaction condition code\r
+# */\r
+sub GetTransactionConditionCode\r
+{\r
+  my $self = shift;\r
+  $self->{strTransactionConditionCode};\r
+}\r
+\r
+#/**\r
+# * Gets the xid\r
+# */\r
+sub GetXID\r
+{\r
+  my $self = shift;\r
+  $self->{strXID};\r
+}\r
+\r
+#/**\r
+# * Gets tax exempt flag\r
+# */\r
+sub GetTaxExempt\r
+{\r
+  my $self = shift;\r
+  $self->{boolTaxExempt};\r
+}\r
+\r
+#/**\r
+# * Gets invoice number\r
+# */\r
+sub GetInvoiceNumber\r
+{\r
+  my $self = shift;\r
+  $self->{strInvoiceNumber};\r
+}\r
+\r
+#/**\r
+# * Gets the Authentication Transaction ID\r
+# * \r
+# * Used in Payer Authentication transaction type\r
+# */\r
+sub GetAuthenticationTransactionId\r
+{\r
+  my $self = shift;\r
+  $self->{strAuthenticationTransactionId};\r
+}\r
+\r
+#/**\r
+# * Gets the Authentication Payload\r
+# * \r
+# * Used in Payer Authentication transaction type\r
+# */\r
+sub GetAuthenticationPayload\r
+{\r
+  my $self = shift;\r
+  $self->{strAuthenticationPayload};\r
+}\r
+\r
+#/**\r
+# * Gets the Success On Authentication Inconclusive\r
+# * \r
+# * Used in Payer Authentication transaction type\r
+# */\r
+sub GetDoTransactionOnAuthenticationInconclusive\r
+{\r
+  my $self = shift;\r
+  $self->{boolSuccessOnAuthenticationInconclusive};\r
+}\r
+\r
+\r
+#/**\r
+# * Gets the industry\r
+# */\r
+sub GetIndustry\r
+{\r
+  my $self = shift;\r
+  $self->{strIndustry};\r
+}\r
+\r
+#/**\r
+# * Gets the folio number\r
+# */\r
+sub GetFolioNumber\r
+{\r
+  my $self = shift;\r
+  $self->{strFolioNumber};\r
+}\r
+\r
+#/**\r
+# * Gets the service rate\r
+# */\r
+sub GetServiceRate\r
+{\r
+  my $self = shift;\r
+  $self->{dServiceRate};\r
+}\r
+\r
+#/**\r
+# * Gets the service rate as a String\r
+# */\r
+sub GetServiceRateStr\r
+{\r
+  my $self = shift;\r
+  $self->{strServiceRate};\r
+}\r
+\r
+#/**\r
+# * Gets the service start year\r
+# */\r
+sub GetServiceStartYear\r
+{\r
+  my $self = shift;\r
+  $self->{intServiceStartYear};\r
+}\r
+\r
+#/**\r
+# * Gets the service start month\r
+# */\r
+sub GetServiceStartMonth\r
+{\r
+  my $self = shift;\r
+  $self->{intServiceStartMonth};\r
+}\r
+\r
+#/**\r
+# * Gets the service start day\r
+# */\r
+sub GetServiceStartDay\r
+{\r
+  my $self = shift;\r
+  $self->{intServiceStartDay};\r
+}\r
+\r
+#/**\r
+# * Gets the service end year\r
+# */\r
+sub GetServiceEndYear\r
+{\r
+  my $self = shift;\r
+  $self->{intServiceEndYear};\r
+}\r
+\r
+#/**\r
+# * Gets the service end month\r
+# */\r
+sub GetServiceEndMonth\r
+{\r
+  my $self = shift;\r
+  $self->{intServiceEndMonth};\r
+}\r
+\r
+#/**\r
+# * Gets the service end day\r
+# */\r
+sub GetServiceEndDay\r
+{\r
+  my $self = shift;\r
+  $self->{intServiceEndDay};\r
+}\r
+\r
+#/**\r
+# * Gets the Charge Total Includes Restaurant flag\r
+# */\r
+sub GetChargeTotalIncludesRestaurant\r
+{\r
+  my $self = shift;\r
+  $self->{boolChargeTotalIncludesRestaurant};\r
+}\r
+\r
+#/**\r
+# * Gets the Charge Total Includes Giftshop flag\r
+# */\r
+sub GetChargeTotalIncludesGiftshop\r
+{\r
+  my $self = shift;\r
+  $self->{boolChargeTotalIncludesGiftshop};\r
+}\r
+\r
+#/**\r
+# * Gets the Charge Total Includes Minibar flag\r
+# */\r
+sub GetChargeTotalIncludesMinibar\r
+{\r
+  my $self = shift;\r
+  $self->{boolChargeTotalIncludesMinibar};\r
+}\r
+\r
+#/**\r
+# * Gets the Charge Total Includes Laundry flag\r
+# */\r
+sub GetChargeTotalIncludesLaundry\r
+{\r
+  my $self = shift;\r
+  $self->{boolChargeTotalIncludesLaundry};\r
+}\r
+\r
+#/**\r
+# * Gets the Charge Total Includes Phone flag\r
+# */\r
+sub GetChargeTotalIncludesPhone\r
+{\r
+  my $self = shift;\r
+  $self->{boolChargeTotalIncludesPhone};\r
+}\r
+\r
+#/**\r
+# * Gets the Charge Total Includes Other flag\r
+# */\r
+sub GetChargeTotalIncludesOther\r
+{\r
+  my $self = shift;\r
+  $self->{boolChargeTotalIncludesOther};\r
+}\r
+\r
+#/**\r
+# * Gets the Service No Show flag\r
+# */\r
+sub GetServiceNoShow\r
+{\r
+  my $self = shift;\r
+  $self->{boolServiceNoShow};\r
+}\r
+\r
+\r
+\r
+#**\r
+# * Method to create the post string.\r
+# */\r
+sub WriteRequest\r
+{\r
+  my $self = shift;\r
+  my $class =ref($self);\r
+  my $PostString = shift; # a pointer to string as arguement\r
+  my $temp = "";\r
+  $self->SUPER::WriteRequest($PostString);\r
+  \r
+#        Cartridge Type\r
+  $temp = Encode( $self->{strCartridgeType} );\r
+  $$PostString .= "cartridge_type=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#        Ecommerce Indicator\r
+  $temp = Encode( $self->{strEcommerceIndicator} );\r
+  $$PostString .= "ecommerce_indicator=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#       fixed value for transaction_type\r
+  $$PostString .= "transaction_type=CREDIT_CARD";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#       creditCardNumber\r
+  $temp = Encode( $self->{strCreditCardNumber} );\r
+  $$PostString .= "credit_card_number=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#       creditCardVerificationNumber\r
+  $temp = Encode( $self->{strCreditCardVerificationNumber} );\r
+  $$PostString .= "credit_card_verification_number=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+# expireMonth\r
+  $temp = Encode( $self->{strExpireMonth} );\r
+  $$PostString .= "expire_month=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+# expireYear\r
+  $temp = Encode( $self->{strExpireYear} );\r
+  $$PostString .= "expire_year=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#  chargeType\r
+  $temp = Encode( $self->{strChargeType} );\r
+  $$PostString .= "charge_type=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   chargeTotal\r
+  $$PostString .= "charge_total=";\r
+  $$PostString .= Encode( $self->{dChargeTotal} );\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   cardBrand\r
+#  $$PostString .= "card_brand=";\r
+#  $$PostString .= Encode( $self->{strCardBrand} );\r
+#  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   orderId\r
+  $temp = Encode( $self->{strOrderId} );\r
+  $$PostString .= "order_id=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#    captureReferenceId\r
+  $temp = Encode( $self->{strReferenceId} );\r
+  $$PostString .= "reference_id=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   orderDescription\r
+  $temp = Encode( $self->{strOrderDescription} );\r
+  $$PostString .= "order_description=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#    orderUserId\r
+  $temp = Encode( $self->{strOrderUserId} );\r
+  $$PostString .= "order_user_id=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#    BankApprovalCode\r
+  $temp = Encode( $self->{strBankApprovalCode} );\r
+  $$PostString .= "bank_approval_code=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#    DuplicateCheck\r
+  $temp = Encode( $self->{strDuplicateCheck} );\r
+  $$PostString .= "duplicate_check=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#   taxAmount\r
+  $$PostString .= "tax_amount=";\r
+  $$PostString .= Encode( $self->{dTaxAmount} );\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shippingCharge\r
+  $$PostString .= "shipping_charge=";\r
+  $$PostString .= Encode( $self->{dShippingCharge} );\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billFirstName\r
+  $temp = Encode( $self->{strBillFirstName} );\r
+  $$PostString .= "bill_first_name=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billMiddleName\r
+  $temp = Encode( $self->{strBillMiddleName} );\r
+  $$PostString .= "bill_middle_name=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billLastName\r
+  $temp = Encode( $self->{strBillLastName} );\r
+  $$PostString .= "bill_last_name=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billCustomerTitle\r
+  $temp = Encode( $self->{strBillCustomerTitle} );\r
+  $$PostString .= "bill_customer_title=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billCompany\r
+  $temp = Encode( $self->{strBillCompany} );\r
+  $$PostString .= "bill_company=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billAddressOne\r
+  $temp = Encode( $self->{strBillAddressOne} );\r
+  $$PostString .= "bill_address_one=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billAddressTwo\r
+  $temp = Encode( $self->{strBillAddressTwo} );\r
+  $$PostString .= "bill_address_two=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billCity\r
+  $temp = Encode( $self->{strBillCity} );\r
+  $$PostString .= "bill_city=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billStateOrProvince\r
+  $temp = Encode( $self->{strBillStateOrProvince} );\r
+  $$PostString .= "bill_state_or_province=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#    billPostalCode\r
+  $temp = Encode( $self->{strBillPostalCode} );\r
+  $$PostString .= "bill_postal_code=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billCountryCode\r
+  $temp = Encode( $self->{strBillCountryCode} );\r
+  $$PostString .= "bill_country_code=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billEmail\r
+  $temp = Encode( $self->{strBillEmail} );\r
+  $$PostString .= "bill_email=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billPhone\r
+  $temp = Encode( $self->{strBillPhone} );\r
+  $$PostString .= "bill_phone=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billFax\r
+  $temp = Encode( $self->{strBillFax} );\r
+  $$PostString .= "bill_fax=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   billNote\r
+  $temp = Encode( $self->{strBillNote} );\r
+  $$PostString .= "bill_note=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipFirstName\r
+  $temp = Encode( $self->{strShipFirstName} );\r
+  $$PostString .= "ship_first_name=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipMiddleName\r
+  $temp = Encode( $self->{strShipMiddleName} );\r
+  $$PostString .= "ship_middle_name=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipLastName\r
+  $temp = Encode( $self->{strShipLastName} );\r
+  $$PostString .= "ship_last_name=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipCustomerTitle\r
+  $temp = Encode( $self->{strShipCustomerTitle} );\r
+  $$PostString .= "ship_customer_title=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#  shipCompany\r
+  $temp = Encode( $self->{strShipCompany} );\r
+  $$PostString .= "ship_company=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipAddressOne\r
+  $temp = Encode( $self->{strShipAddressOne} );\r
+  $$PostString .= "ship_address_one=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipAddressTwo\r
+  $temp = Encode( $self->{strShipAddressTwo} );\r
+  $$PostString .= "ship_address_two=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipCity\r
+  $temp = Encode( $self->{strShipCity} );\r
+  $$PostString .= "ship_city=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipStateOrProvince\r
+  $temp = Encode( $self->{strShipStateOrProvince} );\r
+  $$PostString .= "ship_state_or_province=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#  shipPostalCode\r
+  $temp = Encode( $self->{strShipPostalCode} );\r
+  $$PostString .= "ship_postal_code=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipCountryCode\r
+  $temp = Encode( $self->{strShipCountryCode} );\r
+  $$PostString .= "ship_country_code=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipEmail\r
+  $temp = Encode( $self->{strShipEmail} );\r
+  $$PostString .= "ship_email=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipPhone\r
+  $temp = Encode( $self->{strShipPhone} );\r
+  $$PostString .= "ship_phone=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipFax\r
+  $temp = Encode( $self->{strShipFax} );\r
+  $$PostString .= "ship_fax=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   shipNote\r
+  $temp = Encode( $self->{strShipNote} );\r
+  $$PostString .= "ship_note=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
\r
+#   Currency \r
+#  $temp = Encode( $self->{strCurrency} );\r
+#  $$PostString .= "currency=$temp";\r
+#  $$PostString .= $self->{strParamSeparator};\r
+\r
+#   Buyer Code\r
+  $temp = Encode( $self->{strBuyerCode} );\r
+  $$PostString .= "buyer_code=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#   CAVV\r
+  $temp = Encode( $self->{strCAVV} );\r
+  $$PostString .= "cavv=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#   Customer IP Address\r
+  $temp = Encode( $self->{strCustomerIPAddress} );\r
+  $$PostString .= "customer_ip_address=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#   Order Customer ID\r
+  $temp = Encode( $self->{strOrderCustomerID} );\r
+  $$PostString .= "order_customer_id=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#   Purchase Order Number\r
+  $temp = Encode( $self->{strPurchaseOrderNumber} );\r
+  $$PostString .= "purchase_order_number=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#   State Tax\r
+  $temp = Encode( $self->{dStateTax} );\r
+  if( $temp == -1 ) {\r
+    $temp = "";\r
+  }\r
+  $$PostString .= "state_tax=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#   Track 1\r
+  $temp = Encode( $self->{strTrack1} );\r
+  $$PostString .= "track1=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#   Track 2\r
+  $temp = Encode( $self->{strTrack2} );\r
+  $$PostString .= "track2=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#   Transaction condition code\r
+  $temp = Encode( $self->{strTransactionConditionCode} );\r
+  $$PostString .= "transaction_condition_code=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#   XID\r
+  $temp = Encode( $self->{strXID} );\r
+  $$PostString .= "x_id=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+#   Invoice number\r
+  $temp = Encode( $self->{strInvoiceNumber} );\r
+  $$PostString .= "invoice_number=$temp";\r
+  $$PostString .= $self->{strParamSeparator};  \r
+\r
+#   Tax Exempt\r
+  $temp = $self->{boolTaxExempt};\r
+  if ( $temp eq "" ) {\r
+    #not set.  leave it.\r
+  } elsif ( $temp ) {\r
+    $temp = "true";\r
+  } elsif(! $temp) {\r
+    $temp = "false";\r
+  } else {\r
+    $temp = "";\r
+  }\r
+  $$PostString .= "tax_exempt=$temp";\r
+  $$PostString .= $self->{strParamSeparator}; \r
+  \r
+#   Authentication Transaction ID\r
+  $temp = Encode( $self->{strAuthenticationTransactionId} );\r
+  $$PostString .= "authentication_transaction_id=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+\r
+#   Authentication Payload\r
+  $temp = Encode( $self->{strAuthenticationPayload} );\r
+  $$PostString .= "authentication_payload=$temp";\r
+  $$PostString .= $self->{strParamSeparator};  \r
+\r
+#   Success On Authentication Inconclusive\r
+  $temp = $self->{boolSuccessOnAuthenticationInconclusive};\r
+  if ( $temp eq "" ) {\r
+    #not set.  leave it.\r
+  } elsif ( $temp ) {\r
+    $temp = "true";\r
+  } elsif(!$temp) {\r
+    $temp = "false";\r
+  } else {\r
+    $temp = "";\r
+  }\r
+  $$PostString .= "success_on_authentication_inconclusive=$temp";\r
+  $$PostString .= $self->{strParamSeparator};  \r
+  \r
+#   Industry\r
+  $temp = Encode( $self->{strIndustry} );\r
+  $$PostString .= "industry=$temp";\r
+  $$PostString .= $self->{strParamSeparator};  \r
+  \r
+#   Folio number\r
+  $temp = Encode( $self->{strFolioNumber} );\r
+  $$PostString .= "folio_number=$temp";\r
+  $$PostString .= $self->{strParamSeparator};  \r
+  \r
+#   Service Rate\r
+  $temp = Encode( $self->{dServiceRate} );\r
+  if( $temp == -1 ) {\r
+    $temp = "";\r
+  }\r
+  $$PostString .= "service_rate=$temp";\r
+  $$PostString .= $self->{strParamSeparator};\r
+  \r
+# Service Start Day\r
+  $temp = Encode( $self->{intServiceStartDay} );\r
+  $$PostString .= "service_start_day=$temp";\r
+  $$PostString .= $self->{strParamSeparator};  \r
+  \r
+# Service Start Month\r
+  $temp = Encode( $self->{intServiceStartMonth} );\r
+  $$PostString .= "service_start_month=$temp";\r
+  $$PostString .= $self->{strParamSeparator};  \r
+  \r
+# Service Start Year\r
+  $temp = Encode( $self->{intServiceStartYear} );\r
+  $$PostString .= "service_start_year=$temp";\r
+  $$PostString .= $self->{strParamSeparator};  \r
+  \r
+# Service End Day\r
+  $temp = Encode( $self->{intServiceEndDay} );\r
+  $$PostString .= "service_end_day=$temp";\r
+  $$PostString .= $self->{strParamSeparator};  \r
+  \r
+# Service End Month\r
+  $temp = Encode( $self->{intServiceEndMonth} );\r
+  $$PostString .= "service_end_month=$temp";\r
+  $$PostString .= $self->{strParamSeparator};  \r
+  \r
+# Service End Year\r
+  $temp = Encode( $self->{intServiceEndYear} );\r
+  $$PostString .= "service_end_year=$temp";\r
+  $$PostString .= $self->{strParamSeparator};  \r
+  \r
+# Charge Total Includes Restaurant\r
+  $temp = Encode( $self->{boolChargeTotalIncludesRestaurant} );\r
+    if ( $temp eq "" ) {\r
+      #not set.  leave it.\r
+    } elsif ( $temp ) {\r
+      $temp = "true";\r
+    } elsif(!$temp) {\r
+      $temp = "false";\r
+    } else {\r
+      $temp = "";\r
+  }\r
+  $$PostString .= "charge_total_incl_restaurant=$temp";\r
+  $$PostString .= $self->{strParamSeparator};  \r
+  \r
+# Charge Total Includes Giftshop\r
+  $temp = Encode( $self->{boolChargeTotalIncludesGiftshop} );\r
+    if ( $temp eq "" ) {\r
+      #not set.  leave it.\r
+    } elsif ( $temp ) {\r
+      $temp = "true";\r
+    } elsif(!$temp) {\r
+      $temp = "false";\r
+    } else {\r
+      $temp = "";\r
+  }\r
+  $$PostString .= "charge_total_incl_giftshop=$temp";\r
+  $$PostString .= $self->{strParamSeparator}; \r
+  \r
+# Charge Total Includes Minibar\r
+  $temp = Encode( $self->{boolChargeTotalIncludesMinibar} );\r
+    if ( $temp eq "" ) {\r
+      #not set.  leave it.\r
+    } elsif ( $temp ) {\r
+      $temp = "true";\r
+    } elsif(!$temp) {\r
+      $temp = "false";\r
+    } else {\r
+      $temp = "";\r
+  }\r
+  $$PostString .= "charge_total_incl_minibar=$temp";\r
+  $$PostString .= $self->{strParamSeparator}; \r
+  \r
+# Charge Total Includes Phone\r
+  $temp = Encode( $self->{boolChargeTotalIncludesPhone} );\r
+    if ( $temp eq "" ) {\r
+      #not set.  leave it.\r
+    } elsif ( $temp ) {\r
+      $temp = "true";\r
+    } elsif(!$temp) {\r
+      $temp = "false";\r
+    } else {\r
+      $temp = "";\r
+  }\r
+  $$PostString .= "charge_total_incl_phone=$temp";\r
+  $$PostString .= $self->{strParamSeparator}; \r
+\r
+# Charge Total Includes Laundry\r
+  $temp = Encode( $self->{boolChargeTotalIncludesLaundry} );\r
+    if ( $temp eq "" ) {\r
+      #not set.  leave it.\r
+    } elsif ( $temp ) {\r
+      $temp = "true";\r
+    } elsif(!$temp) {\r
+      $temp = "false";\r
+    } else {\r
+      $temp = "";\r
+  }\r
+  $$PostString .= "charge_total_incl_laundry=$temp";\r
+  $$PostString .= $self->{strParamSeparator}; \r
+  \r
+# Charge Total Includes Other\r
+  $temp = Encode( $self->{boolChargeTotalIncludesOther} );\r
+    if ( $temp eq "" ) {\r
+      #not set.  leave it.\r
+    } elsif ( $temp ) {\r
+      $temp = "true";\r
+    } elsif(!$temp) {\r
+      $temp = "false";\r
+    } else {\r
+      $temp = "";\r
+  }\r
+  $$PostString .= "charge_total_incl_other=$temp";\r
+  $$PostString .= $self->{strParamSeparator}; \r
+  \r
+# Service No Show\r
+  $temp = Encode( $self->{boolServiceNoShow} );\r
+    if ( $temp eq "" ) {\r
+      #not set.  leave it.\r
+    } elsif ( $temp ) {\r
+      $temp = "true";\r
+    } elsif(!$temp) {\r
+      $temp = "false";\r
+    } else {\r
+      $temp = "";\r
+  }\r
+  $$PostString .= "service_no_show=$temp";\r
+  \r
+# No parameter separator on last line.\r
+\r
+}\r
+\r
+sub GetErrorString\r
+{\r
+  my $self = shift;\r
+  return $self->{strError};\r
+}\r
+\r
+\r
diff --git a/lib/Business/OnlinePayment/PPIPayMover/CreditCardResponse.pm b/lib/Business/OnlinePayment/PPIPayMover/CreditCardResponse.pm
new file mode 100644 (file)
index 0000000..3cf5ae3
--- /dev/null
@@ -0,0 +1,201 @@
+package Business::OnlinePayment::PPIPayMover::CreditCardResponse;\r
+\r
+use strict;\r
+use vars qw(@ISA);\r
+use Business::OnlinePayment::PPIPayMover::TransactionResponse;\r
+use Business::OnlinePayment::PPIPayMover::PayerAuthenticationResponse;\r
+use Business::OnlinePayment::PPIPayMover::constants;\r
+\r
+@ISA = qw(Business::OnlinePayment::PPIPayMover::TransactionResponse);\r
+\r
+sub new {\r
+  my $class = shift;\r
+  my $InString = shift;\r
+  my $self = $class->SUPER::new($InString);\r
+   \r
+  $self->{oPayerAuthenticationResponse} = undef;\r
+  $self->{strReferenceId} = undef;\r
+  $self->{strBatchId} = undef;\r
+  $self->{strBankTransactionId} = undef;\r
+  $self->{strBankApprovalCode} = undef;\r
+  $self->{strState} = undef;\r
+  $self->{strAuthorizedAmount} = undef;\r
+  $self->{strOriginalAuthorizedAmount} = undef;\r
+  $self->{strCapturedAmount} = undef;\r
+  $self->{strCreditedAmount} = undef;\r
+  $self->{strTimeStampCreated} = undef;\r
+  $self->{strOrderId} = undef;\r
+  $self->{strIsoCode} = undef;\r
+  $self->{strAVSCode} = "None";    # v1.5\r
+  $self->{strCreditCardVerificationResponse} = undef;\r
+  \r
+  if ($self->{iResponseCode} == TRANSACTION_SERVER_ERROR || $self->{iResponseCode} == INVALID_VERSION) {\r
+    return $self;\r
+  }\r
+  if (!($$InString) && !($self->{iResponseCode} == SUCCESSFUL_TRANSACTION)) {\r
+    return $self;\r
+  }\r
+  \r
+  my @temp = split(/\n/, $$InString);\r
+  my $size = @temp;\r
+  if ($size < 10) {\r
+    $self->{strError} .= "input string is in wrong format";\r
+    $self->{iRetVal} = 0;\r
+    return $self;\r
+  }\r
+  \r
+  # Looking to see if there is a nested Payer Authentication Response\r
+  my $payerAuthResponse = new Business::OnlinePayment::PPIPayMover::TransactionResponse($InString,AUTHENTICATION_PREFIX);\r
+  \r
+  if (defined($payerAuthResponse->GetResponseCode)){\r
+       $self->{oPayerAuthenticationResponse} = new Business::OnlinePayment::PPIPayMover::PayerAuthenticationResponse($InString,AUTHENTICATION_PREFIX);\r
+  }\r
+  \r
+  my $name;\r
+  my $value;\r
+  foreach (@temp) {\r
+  \r
+    ($name, $value) = split(/=/, $_, 2);\r
+    \r
+    if ($name eq "capture_reference_id") {\r
+      $self->{strReferenceId} = $value;\r
+    }\r
+    elsif ($name eq "order_id") {\r
+      $self->{strOrderId} = $value;\r
+    }\r
+    elsif ($name eq "iso_code") {\r
+      $self->{strIsoCode} = $value;\r
+    }\r
+    elsif ($name eq "bank_approval_code") {\r
+      $self->{strBankApprovalCode} = $value;\r
+    }\r
+    elsif ($name eq "state") {\r
+      $self->{strState} = $value;\r
+    }\r
+    elsif ($name eq "authorized_amount") {\r
+      $self->{strAuthorizedAmount} = $value;\r
+    }\r
+    elsif ($name eq "original_authorized_amount") {\r
+      $self->{strOriginalAuthorizedAmount} = $value;\r
+    }\r
+    elsif ($name eq "captured_amount") {\r
+      $self->{strCapturedAmount} = $value;\r
+    }\r
+    elsif ($name eq "credited_amount") {\r
+      $self->{strCreditedAmount} = $value;\r
+    }\r
+    elsif ($name eq "time_stamp_created") {\r
+      $self->{strTimeStampCreated} = $value;\r
+    }\r
+    elsif ($name eq "bank_transaction_id") {\r
+      $self->{strBankTransactionId} = $value;\r
+    }\r
+    elsif ($name eq "batch_id") {\r
+      $self->{strBatchId } = $value;\r
+    }\r
+    elsif ($name eq "avs_code") {\r
+      $self->{strAVSCode} = $value;\r
+    }\r
+    elsif ($name eq "credit_card_verification_response") {\r
+      $self->{strCreditCardVerificationResponse} = $value;\r
+    }\r
+    else {\r
+      $self->{strError} .= "Invalid data name: ";\r
+    }\r
+  }\r
+  return $self;\r
+}\r
+\r
+\r
+sub GetBatchId\r
+{\r
+  my $self = shift;\r
+  $self->{strBatchId};\r
+}\r
+\r
+sub GetBankTransactionId\r
+{\r
+  my $self = shift;\r
+  $self->{strBankTransactionId};\r
+}\r
+\r
+sub GetBankApprovalCode\r
+{\r
+  my $self = shift;\r
+  $self->{strBankApprovalCode};\r
+}\r
+\r
+sub GetState\r
+{\r
+  my $self = shift;\r
+  $self->{strState};\r
+}\r
+\r
+sub GetAuthorizedAmount\r
+{\r
+  my $self = shift;\r
+  $self->{strAuthorizedAmount};\r
+}\r
+\r
+sub GetOriginalAuthorizedAmount\r
+{\r
+  my $self = shift;\r
+  $self->{strOriginalAuthorizedAmount};\r
+}\r
+\r
+sub GetCapturedAmount\r
+{\r
+  my $self = shift;\r
+  $self->{strCapturedAmount};\r
+}\r
+\r
+sub GetCreditedAmount\r
+{\r
+  my $self = shift;\r
+  $self->{strCreditedAmount};\r
+}\r
+\r
+sub GetTimeStampCreated\r
+{\r
+  my $self = shift;\r
+  $self->{strTimeStampCreated};\r
+}\r
+\r
+sub GetOrderId\r
+{\r
+  my $self = shift;\r
+  $self->{strOrderId};\r
+}\r
+\r
+sub GetIsoCode\r
+{\r
+  my $self = shift;\r
+  $self->{strIsoCode};\r
+}\r
+\r
+sub GetCaptureReferenceId\r
+{\r
+  my $self = shift;\r
+  $self->{strReferenceId};\r
+}\r
+\r
+sub GetReferenceId\r
+{\r
+  my $self = shift;\r
+  $self->{strReferenceId};\r
+}\r
+\r
+sub GetAVSCode {\r
+    my $self = shift;\r
+    $self->{strAVSCode};\r
+}\r
+\r
+sub GetCreditCardVerificationResponse {\r
+    my $self = shift;\r
+    $self->{strCreditCardVerificationResponse};\r
+}\r
+\r
+sub GetPayerAuthenticationResponse {\r
+    my $self = shift;\r
+    $self->{oPayerAuthenticationResponse};\r
+}\r
diff --git a/lib/Business/OnlinePayment/PPIPayMover/PayerAuthenticationResponse.pm b/lib/Business/OnlinePayment/PPIPayMover/PayerAuthenticationResponse.pm
new file mode 100644 (file)
index 0000000..e679865
--- /dev/null
@@ -0,0 +1,140 @@
+package Business::OnlinePayment::PPIPayMover::PayerAuthenticationResponse;\r
+\r
+use strict;\r
+use vars qw(@ISA);\r
+use Business::OnlinePayment::PPIPayMover::TransactionResponse;\r
+use Business::OnlinePayment::PPIPayMover::constants;\r
+\r
+@ISA = qw(Business::OnlinePayment::PPIPayMover::TransactionResponse);\r
+\r
+sub new {\r
+  my $class = shift;\r
+  my @param = @_;\r
+  my $paramNo = @param;\r
+  \r
+  my $InString = shift;\r
+  my $prefix = "";\r
+    \r
+  if( $paramNo == 2){\r
+    $prefix = shift;\r
+  }\r
+  my $self = $class->SUPER::new($InString,$prefix);\r
+  \r
+  $self->{strAuthenticationTransactionId} = "";\r
+  $self->{strLookupPayload} = "";\r
+  $self->{strHiddenFields} = "";\r
+  $self->{strOrderId} = "";\r
+  $self->{strAuthenticationURL} = "";\r
+  $self->{strCavv} = "";\r
+  $self->{strXID} = "";\r
+  $self->{strStatus} = "";\r
+  $self->{strTransactionConditionCode} = "";\r
+  if ($self->{iResponseCode} == TRANSACTION_SERVER_ERROR || $self->{iResponseCode} == INVALID_VERSION) {\r
+    return $self;\r
+  }\r
+  if (!($$InString) && !($self->{iResponseCode} == SUCCESSFUL_TRANSACTION)) {\r
+    return $self;\r
+  }\r
+  \r
+  my @temp = split(/\n/, $$InString);\r
+  my $size = @temp;\r
+  if ($size < 10) {\r
+    $self->{strError} .= "input string is in wrong format";\r
+    $self->{iRetVal} = 0;\r
+    return $self;\r
+  }\r
+  #splice(@temp, 0, 4);\r
+  my $name;\r
+  my $value;\r
+  foreach (@temp) {\r
+  \r
+    # Anything after the first = is part\r
+    # of the value (including other ='s)\r
+    ($name, $value) = split(/=/, $_, 2);\r
+    \r
+    if ($name eq $prefix."authentication_transaction_id") {\r
+      $self->{strAuthenticationTransactionId} = $value;\r
+    }\r
+    elsif ($name eq $prefix."lookup_payload") {\r
+      $self->{strLookupPayload} = $value;\r
+    }\r
+    elsif ($name eq $prefix."hidden_fields") {\r
+      $self->{strHiddenFields} = $value;\r
+    }\r
+    elsif ($name eq $prefix."order_id") {\r
+      $self->{strOrderId} = $value;\r
+    }\r
+    elsif ($name eq $prefix."authentication_url") {\r
+      $self->{strAuthenticationURL} = $value;\r
+    }\r
+    elsif ($name eq $prefix."cavv") {\r
+      $self->{strCavv } = $value;\r
+    }\r
+    elsif ($name eq $prefix."x_id") {\r
+      $self->{strXID} = $value;\r
+    }\r
+    elsif ($name eq $prefix."status") {\r
+      $self->{strStatus} = $value;\r
+    }\r
+    elsif ($name eq $prefix."transaction_condition_code") {\r
+          $self->{strTransactionConditionCode} = $value;\r
+    }\r
+    else {\r
+      $self->{strError} .= "Invalid data name: ";\r
+    }\r
+  }\r
+  return $self;\r
+}\r
+\r
+\r
+sub GetAuthenticationTransactionId\r
+{\r
+  my $self = shift;\r
+  $self->{strAuthenticationTransactionId};\r
+}\r
+\r
+sub GetLookupPayload\r
+{\r
+  my $self = shift;\r
+  $self->{strLookupPayload};\r
+}\r
+\r
+sub GetHiddenFields\r
+{\r
+  my $self = shift;\r
+  $self->{strHiddenFields};\r
+}\r
+\r
+sub GetOrderId\r
+{\r
+  my $self = shift;\r
+  $self->{strOrderId};\r
+}\r
+\r
+sub GetAuthenticationURL\r
+{\r
+  my $self = shift;\r
+  $self->{strAuthenticationURL};\r
+}\r
+\r
+sub GetCavv\r
+{\r
+  my $self = shift;\r
+  $self->{strCavv};\r
+}\r
+\r
+sub GetXID\r
+{\r
+  my $self = shift;\r
+  $self->{strXID};\r
+}\r
+\r
+sub GetStatus {\r
+    my $self = shift;\r
+    $self->{strStatus};\r
+}\r
+\r
+sub GetTransactionConditionCode {\r
+    my $self = shift;\r
+    $self->{strTransactionConditionCode};\r
+}\r
diff --git a/lib/Business/OnlinePayment/PPIPayMover/SecureHttp.pm b/lib/Business/OnlinePayment/PPIPayMover/SecureHttp.pm
new file mode 100644 (file)
index 0000000..bd03acd
--- /dev/null
@@ -0,0 +1,155 @@
+use strict;\r
+package Business::OnlinePayment::PPIPayMover::SecureHttp;\r
+use Socket;\r
+use Net::SSLeay qw(die_now die_if_ssl_error) ;\r
+1;\r
+\r
+# constuctor\r
+sub new\r
+{\r
+  my $class = shift;\r
+  my $self = {};\r
+  bless $self, $class;\r
+  $self->{ctx} = undef;\r
+  $self->{ssl} = undef;\r
+  $self->{strError} = ""; \r
+  return $self;\r
+}\r
+\r
+sub Init\r
+{\r
+  my $self = shift;  \r
+  \r
+  Net::SSLeay::load_error_strings();\r
+  Net::SSLeay::ERR_load_crypto_strings();\r
+  Net::SSLeay::SSLeay_add_ssl_algorithms();\r
+  Net::SSLeay::randomize();\r
+  \r
+  $self->{ctx} = Net::SSLeay::CTX_new();\r
+  if(!$self->{ctx}) {\r
+      $self->{strError} .= "Failed to create SSL_CTX. \n" .\r
+         "SSLeay error: " . Net::SSLeay::ERR_error_string(Net::SSLeay::ERR_get_error);\r
+      return 0;\r
+  }\r
+  \r
+  if(!Net::SSLeay::CTX_set_options($self->{ctx}, &Net::SSLeay::OP_ALL)) {\r
+      # For some reason the if statement above always returns false,\r
+      # but SSLeay reports no error.  Ignore this error, since\r
+      # everything still works fine.\r
+      #\r
+      #$self->{strError} .= "Failed to set SSL_CTX options. \n" .\r
+      #   "SSLeay error: " . Net::SSLeay::ERR_error_string(Net::SSLeay::ERR_get_error) . "\n";\r
+  }\r
+  \r
+  $self->{ssl} = Net::SSLeay::new($self->{ctx});\r
+  if(!$self->{ssl}) {\r
+      $self->{strError} .= "Failed to create an SSL. \n" .\r
+         "SSLeay error: " . Net::SSLeay::ERR_error_string(Net::SSLeay::ERR_get_error);\r
+      return 0;\r
+  }\r
+  \r
+  return 1;\r
+}\r
+\r
+sub Connect\r
+{\r
+  my $self = shift;\r
+  my ($destServer, $port) = @_;\r
+  $port = getservbyname($port, 'tcp') unless $port =~ /^\d+$/;\r
+  \r
+  my $destIp = gethostbyname ($destServer);\r
+  if(!defined($destIp)) { \r
+      $self->{strError} .= "Couldn't resolve host name (gethostbyname) using host: $destServer\n";\r
+      return 0;\r
+  } \r
+  \r
+  my $destServerSockAddr = sockaddr_in($port, $destIp);\r
+  \r
+  if(!socket (S, AF_INET, SOCK_STREAM, 0)) {\r
+      $self->{strError} .= "Failed to create a socket. $!";\r
+      return 0;\r
+  }\r
+  \r
+  if(!connect (S, $destServerSockAddr)) {\r
+      $self->{strError} .= "Failed to connect. $!";\r
+      return 0;\r
+  }\r
+  \r
+  select (S); $| = 1; select (STDOUT);   # Eliminate STDIO buffering\r
+  Net::SSLeay::set_fd($self->{ssl}, fileno(S));   # Must use fileno\r
+  if (! Net::SSLeay::connect($self->{ssl})) {\r
+    $self->{strError} .= "Failed to make an ssl connect. \n" .\r
+      "SSLeay error: " . Net::SSLeay::ERR_error_string(Net::SSLeay::ERR_get_error);\r
+     return 0;\r
+  }\r
+  \r
+  return 1;\r
+}\r
+\r
+sub DoSecurePost\r
+{\r
+  my $self = shift;\r
+  my ($strPath, $strContent, $Response) = @_;\r
+  my $PostString = "POST ";\r
+  $PostString .= $strPath;\r
+  $PostString .= " HTTP/1.0\r\nContent-Type: application/x-www-form-urlencoded\r\n";\r
+  $PostString .= "Content-Length: ";\r
+  $PostString .= length($strContent);\r
+  $PostString .= "  \r\n\r\n";\r
+  $PostString .= $strContent;\r
+  \r
+  if(!Net::SSLeay::ssl_write_all($self->{ssl}, $PostString)) {\r
+      $self->{strError} .= "Failed to write. " .\r
+         "SSLeay error: " . Net::SSLeay::ERR_error_string(Net::SSLeay::ERR_get_error);\r
+    return 0;\r
+  }\r
+  \r
+  shutdown S, 1;  # Half close --> No more output, sends EOF to server\r
+\r
+  if( $^O eq "MSWin32" ) {\r
+    # Windows doesn't implement ALRM signal, \r
+    # so don't use a timeout.  \r
+    # May hang client system.\r
+    $$Response = Net::SSLeay::ssl_read_all($self->{ssl});\r
+  } else {\r
+    # This block uses the alarm signal\r
+    # to see if the server times out responding.\r
+    eval {\r
+      local $SIG{ ALRM } = sub {\r
+        $self->{strError} .= "Server timed out.";\r
+        close S;\r
+      };\r
+      alarm 270;    # Alarm on 4.5 min timeout\r
+      # Read in response from server\r
+      $$Response = Net::SSLeay::ssl_read_all($self->{ssl});\r
+    };\r
+    alarm 0;    # Alarm off\r
+    \r
+  }\r
+\r
+  if ( !defined( $$Response ) ) {\r
+    $self->{strError} .= "Failed to read from socket. " .\r
+         "SSLeay error: " . Net::SSLeay::ERR_error_string(Net::SSLeay::ERR_get_error);\r
+    return 0;\r
+  }\r
+  return 1;\r
+}\r
+\r
+sub DisconnectFromServer\r
+{\r
+  my $self = shift;\r
+  Net::SSLeay::free ($self->{ssl});               # Tear down connection\r
+  Net::SSLeay::CTX_free ($self->{ctx});\r
+  close S;\r
+}\r
+\r
+sub CleanUp\r
+{\r
+  return 1;\r
+}\r
+\r
+sub GetErrorString\r
+{\r
+  my $self = shift;\r
+  return $self->{strError};\r
+}\r
diff --git a/lib/Business/OnlinePayment/PPIPayMover/TransactionClient.pm b/lib/Business/OnlinePayment/PPIPayMover/TransactionClient.pm
new file mode 100644 (file)
index 0000000..cef6a99
--- /dev/null
@@ -0,0 +1,92 @@
+use strict;\r
+package Business::OnlinePayment::PPIPayMover::TransactionClient;\r
+use Business::OnlinePayment::PPIPayMover::TransactionResponse;\r
+use Business::OnlinePayment::PPIPayMover::TransactionRequest;\r
+use Business::OnlinePayment::PPIPayMover::CreditCardRequest;\r
+use Business::OnlinePayment::PPIPayMover::CreditCardResponse;\r
+use Business::OnlinePayment::PPIPayMover::SecureHttp;\r
+use Business::OnlinePayment::PPIPayMover::constants;\r
+1;\r
+\r
+# default constructor\r
+sub new  {\r
+  my $class = shift;\r
+  my $self = {};\r
+  $self->{strError} = "";\r
+  $self->{strResponse} = "";\r
+  bless $self, $class;\r
+  return $self;\r
+}\r
+\r
+sub doTransaction # take three arguements\r
+{\r
+  my $self = shift;\r
+  my $TransactionKey = shift; # the first arguement(string)\r
+  my $transReq = shift; # the second arguement(class object)\r
+  my $AccountToken = shift; # the third arguement(string)\r
+  \r
+  my $PostString = "";\r
+  my $ResponseString = "";\r
+  \r
+  # write out account_token ...\r
+  $PostString .= "account_token=$AccountToken";\r
+  $PostString .= "&";\r
+  \r
+  # write out transaction_key ...\r
+  #$PostString .= "transaction_key=$TransactionKey";\r
+  #$PostString .= "&";\r
+  \r
+  # write out version_id ...\r
+  my $temp = VERSION;\r
+  $temp =~ tr/ /+/;\r
+  $PostString .= "version_id=$temp";\r
+  $PostString .= "&";\r
\r
+  $transReq->WriteRequest(\$PostString); # get post information\r
+  \r
+  my $ResponseContent;\r
+  my $secureHttp = new Business::OnlinePayment::PPIPayMover::SecureHttp;\r
+  my $strServer = PAY_HOST;\r
+  my $strPath = PAY_HOST_PATH;\r
+  my $iPort = PAY_HOST_PORT;\r
+  \r
+  \r
+  if(!$secureHttp->Init) {\r
+    $self->{strError} = $secureHttp->GetErrorString;\r
+    return undef;\r
+  }\r
+  \r
+  if(!$secureHttp->Connect($strServer, $iPort)) {\r
+    $self->{strError} = $secureHttp->GetErrorString;\r
+    return undef;\r
+  }\r
+  if(!$secureHttp->DoSecurePost($strPath, $PostString, \$self->{strResponse})) {\r
+    $self->{strError} .= $secureHttp->GetErrorString;\r
+    return undef;\r
+  }\r
+  \r
+  $secureHttp->DisconnectFromServer;\r
+  $secureHttp->CleanUp;\r
+  \r
+  my $i = index($self->{strResponse}, "response_code");\r
+  if($i>=0) {\r
+    $ResponseContent = substr($self->{strResponse}, $i);\r
+    return $transReq->GetTransResponseObject(\$ResponseContent);\r
+  }\r
+  else {\r
+    return undef;\r
+  }\r
+}\r
+\r
+\r
+\r
+sub GetErrorString\r
+{\r
+  my $self = shift;\r
+  return $self->{strError};\r
+}\r
+\r
+#JString TransactionClient::GetResponseString()\r
+#{\r
+#      return m_jstrResponse;\r
+#}\r
diff --git a/lib/Business/OnlinePayment/PPIPayMover/TransactionRequest.pm b/lib/Business/OnlinePayment/PPIPayMover/TransactionRequest.pm
new file mode 100644 (file)
index 0000000..c932225
--- /dev/null
@@ -0,0 +1,118 @@
+use strict;\r
+package Business::OnlinePayment::PPIPayMover::TransactionRequest;\r
+use Business::OnlinePayment::PPIPayMover::constants;\r
+use Business::OnlinePayment::PPIPayMover::AdditionalField;\r
+use Business::OnlinePayment::PPIPayMover::TransactionResponse;\r
+1;\r
+\r
+sub new {\r
+  my $class = shift;\r
+  my $self = {};\r
+  $self->{AdditionalFields} = [];\r
+  $self->{strError} = "";\r
+  $self->{strParamSeparator} = "&";\r
+  \r
+  bless $self, $class;\r
+  return $self;\r
+}\r
+\r
+\r
+# *\r
+# * A method to add a single additional field to the TransactionRequest or TransactionRequest subclass\r
+# * (such as CreditCardRequest).\r
+# * <P>\r
+# * @param additionalField An AdditionalField object containing a name and a value. The name must be\r
+# * unique. That is, one TransactionRequest object can contain only one additional field with a given name.\r
+# * <P>\r
+# * @see AdditionalField\r
+# */\r
+sub SetAdditionalField {\r
+  my $self = shift;\r
+  my $additionalField = shift; # take only one AdditionalField object arguement\r
+  foreach (@{$self->{AdditionalFields}}) {\r
+    if ($additionalField->equals($_)) {\r
+      $self->{strError} .= "TransactionRequest.setAddtionalField: name already used";\r
+      return CCR_ERROR;\r
+    }\r
+  }\r
+  ${$self->{AdditionalFields}}[$#{$self->{AdditionalFields}} + 1] = $additionalField;\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+\r
+#**\r
+# * A method to add multiple additional fields to the TransactionRequest or TransactionRequest subclass\r
+# * (such as CreditCardRequest).\r
+# * <P>\r
+# * @param additionalFields An Vector of AdditionalField objects, each containing a name and a value.\r
+# * The parameter cannot be NULL and the Vector must be non-empty.\r
+# * <P>\r
+# * @see AdditionalField\r
+# */\r
+sub SetAdditionalFields {\r
+  my $self = shift;\r
+  my $additionalFields = shift; # take one AdditionalField array arguement\r
+  my $size = @$additionalFields;\r
+  if ($size == 0) {\r
+    $self->{strError} .= "TransactionRequest.setAdditionalFields passed empty vector";\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  foreach (@$additionalFields) {\r
+    if (defined($_)) {$self->SetAdditionalField($_)}\r
+  }\r
+  \r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+#**\r
+# * A method to retrieve an additional field\r
+# * @return Returns an AdditionalField object or NULL if name is unkown\r
+# */\r
+sub GetAdditionalField {\r
+  my $self = shift;\r
+  my $name = shift; # use name as arguement to get additional field arguememt\r
+  foreach (@{$self->{AdditionalFields}}) {\r
+    if ($name = $_->getName) { return $_ }\r
+  }\r
+  return undef;\r
+}\r
+\r
+\r
+#**\r
+# * A method to retrieve a Vector of AdditionalField objects\r
+# * @return Returns a Vector of AdditionalField objects or NULL\r
+# */\r
+sub GetAdditionalFields{\r
+  my $self = shift;\r
+  return @{$self->{AdditionalFields}};\r
+}\r
+\r
+\r
+#**\r
+# * A method for Transaction Server developers that is not used by merchant developers.\r
+# * <P>\r
+# * This method should be overwritten by subclasses, but the subclasses\r
+# * version of this method MUST CALL super.writeRequest(out).\r
+# */\r
+sub WriteRequest {\r
+  my $self = shift;\r
+  my $PostString = shift; #arguement as a pointer to string\r
+  my $size = @{$self->{AdditionalFields}};\r
+  if ($size == 0) {\r
+    return CCR_ERROR;\r
+  }\r
+  \r
+  foreach (@{$self->{AdditionalFields}}) {\r
+    if (defined($_)) {\r
+      $_->write($PostString);\r
+    }\r
+  }\r
+  return CCR_NO_ERROR;\r
+}\r
+\r
+sub GetTransResponseObject {\r
+  my $self = shift;\r
+  my $InString = shift; # use one string arguement\r
+  return new Business::OnlinePayment::PPIPayMover::TransactionResponse($InString);\r
+}\r
diff --git a/lib/Business/OnlinePayment/PPIPayMover/TransactionResponse.pm b/lib/Business/OnlinePayment/PPIPayMover/TransactionResponse.pm
new file mode 100644 (file)
index 0000000..4056864
--- /dev/null
@@ -0,0 +1,171 @@
+use strict;\r
+package Business::OnlinePayment::PPIPayMover::TransactionResponse;\r
+use Business::OnlinePayment::PPIPayMover::constants;\r
+1;\r
+\r
+sub new {\r
+  my $class = shift;\r
+  my @param = @_;\r
+  my $paramNo = @param;\r
+  my $self = {};\r
+  bless $self, $class;\r
+  \r
+  $self->{strError} = "";\r
+  $self->{iRetVal} = undef;\r
+  $self->{iResponseCode} = undef;\r
+  $self->{strResponseCode} = undef;\r
+  $self->{strResponseCodeText} = undef;\r
+  $self->{strTimeStamp} = undef;\r
+  $self->{bRetryRecommended} = undef;\r
+  \r
+  \r
+# constructor for only one or two string arguement\r
+  if ($paramNo == 1 || $paramNo == 2) {\r
+    my $InString = shift;\r
+    my $prefix = "";\r
+    \r
+    if($paramNo == 2){\r
+       $prefix = shift;\r
+    }\r
+    \r
+    if ($$InString eq "") {\r
+      $self->{strError} .=  "Empty response string";\r
+      $self->{iRetVal} = 0;\r
+      return $self;\r
+    }\r
+    my @tmp;\r
+    @tmp = split(/\n/, $$InString);\r
+        \r
+    my $name;\r
+    my $value;\r
+    foreach (@tmp) {\r
+    \r
+      # Anything after the first = is part\r
+      # of the value (including other ='s)\r
+      ($name, $value) = split(/=/, $_, 2);\r
+      \r
+      if (index($name, "<") == 0) {\r
+        $self->{strError} .= "Server not available";\r
+        $self->{iRetVal} = 0;\r
+        \r
+        $self->{iResponseCode} = TRANSACTION_SERVER_ERROR;\r
+        $self->{strResponseCode} = "".$self->{iResponseCode};\r
+        $self->{strResponseCodeText} = "The Transaction Server is currently not available";\r
+        return $self;\r
+      }\r
+\r
+      if ($name eq $prefix."response_code") {\r
+        \r
+        if($value.""  eq "0" || $value."" eq "") {\r
+          $self->{strError} .= "Invalid response code";\r
+          $self->{iRetVal} = 0;\r
+          return $self;\r
+        }\r
+        else  {\r
+          $self->{strResponseCode} = $value;\r
+          $self->{iResponseCode} = 1 * $value;\r
+        }\r
+      }\r
+      elsif ($name eq $prefix."response_code_text"){\r
+        $self->{strResponseCodeText} = $value;\r
+      }\r
+      elsif ($name eq $prefix."time_stamp") {\r
+        $self->{strTimeStamp} = $value;\r
+      }\r
+      elsif ($name eq $prefix."retry_recommended") {\r
+        if ($value eq "true") {\r
+          $self->{bRetryRecommended} = 1;\r
+        }\r
+        elsif ($value eq "false") {\r
+          $self->{bRetryRecommended} = 0;\r
+        }\r
+        else {\r
+          $self->{strError} .= "invalid retry flag";\r
+          return $self;\r
+        }\r
+      }\r
+      else {\r
+        $self->{strError} .= "Invalid data name: ";\r
+      }\r
+    }\r
+  }\r
+  \r
+# constructor for 4 arguements. More arguements are ignored\r
+# (1) ResponseCode(integer), (2) ResponseCodeText(string), (3) TimeStamp(string),\r
+# (4) RetryRecommended(bool: 1 or 0  in the form of integer)\r
+  \r
+  elsif ($paramNo >= 4) {\r
+    my ($iResponseCode, $strResponseCodeText, $strTimeStamp, $bRetryRecommended) = @param[0..3];\r
+    if (!defined($iResponseCode) || $iResponseCode < 1 || !defined($strResponseCodeText) ||\r
+      !defined($strTimeStamp) || !defined($bRetryRecommended)) {\r
+      $self->{strError} .= "Wrong parameter";\r
+      return $self;\r
+    }\r
+    $self->{iResponseCode} = $iResponseCode;\r
+    $self->{strResponseCode} = "".$iResponseCode;\r
+    $self->{strResponseCodeText} = $strResponseCodeText;\r
+    $self->{strTimeStamp} = $strTimeStamp;\r
+    $self->{bRetryRecommended} = $bRetryRecommended;\r
+  }\r
+  else {\r
+    $self->{strError} .= "Parameter number is only $paramNo and more are needed";\r
+    return $self;\r
+  }\r
+  return $self;\r
+}\r
+\r
+\r
+sub GetError {\r
+  my $self = shift;\r
+  $self->{strError};\r
+}\r
+sub GetResponseCode {\r
+  my $self = shift;\r
+  $self->{iResponseCode};\r
+}\r
+\r
+sub GetResponseCodeStrVal {\r
+  my $self = shift;\r
+  $self->{strResponseCode};\r
+}\r
+\r
+sub GetResponseCodeText{\r
+  my $self = shift;\r
+  $self->{strResponseCodeText};\r
+}\r
+\r
+sub GetTimeStamp {\r
+  my $self = shift;\r
+  $self->{strTimeStamp};\r
+}\r
+\r
+sub GetRetryRecommended {\r
+  my $self = shift;\r
+  $self->{bRetryRecommended};\r
+}\r
+\r
+\r
+sub WriteResponse {\r
+  my $self = shift;\r
+  my $outString = shift;\r
+  \r
+  $self->{strResponseCodeText} =~ tr/\n/ /;\r
+  $self->{strTimeStamp} =~ tr/\n/ /;\r
+  $$outString .= "response_code=";\r
+  $$outString .= $self->{strResponseCode};\r
+  $$outString .= "\n";\r
+  $$outString .= "response_code_text=";\r
+  $$outString .= $self->{strResponseCodeText};\r
+  $$outString .= "\n";\r
+  $$outString .= "time_stamp=";\r
+  $$outString .= $self->{strTimeStamp};\r
+  $$outString .= "\n";\r
+  \r
+  if ($self->{bRetryRecommended}) {\r
+    $$outString .= "retry_recommended=true\n";\r
+  }\r
+  else {\r
+    $$outString .= "retry_recommended=false\n";\r
+  }\r
+  return CCR_NO_ERROR;\r
+}\r
diff --git a/lib/Business/OnlinePayment/PPIPayMover/URLEncoder.pm b/lib/Business/OnlinePayment/PPIPayMover/URLEncoder.pm
new file mode 100644 (file)
index 0000000..556b557
--- /dev/null
@@ -0,0 +1,14 @@
+package Business::OnlinePayment::PPIPayMover::URLEncoder;\r
+require Exporter;\r
+@ISA = qw(Exporter);\r
+@EXPORT = qw(Encode);\r
+\r
+1;\r
+\r
+sub Encode {\r
+    #my $self = shift;\r
+    my $value = shift;\r
+\r
+    $value =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;\r
+    return $value;\r
+}\r
diff --git a/lib/Business/OnlinePayment/PPIPayMover/constants.pm b/lib/Business/OnlinePayment/PPIPayMover/constants.pm
new file mode 100644 (file)
index 0000000..0015c74
--- /dev/null
@@ -0,0 +1,631 @@
+package Business::OnlinePayment::PPIPayMover::constants;\r
+\r
+use strict;\r
+use vars qw(@ISA @EXPORT);\r
+use Exporter;\r
+\r
+@ISA = qw(Exporter);\r
+\r
+@EXPORT = qw(VERSION\r
+  PAY_HOST\r
+  PAY_HOST_PATH\r
+  PAY_HOST_PORT\r
+  SUCCESSFUL_TRANSACTION\r
+  MISSING_REQUIRED_REQUEST_FIELD\r
+  INVALID_REQUEST_FIELD\r
+  ILLEGAL_TRANSACTION_REQUEST\r
+  TRANSACTION_SERVER_ERROR\r
+  TRANSACTION_NOT_POSSIBLE\r
+  INVALID_VERSION\r
+  CREDIT_CARD_DECLINED\r
+  ACQUIRER_GATEWAY_ERROR\r
+  PAYMENT_ENGINE_ERROR\r
+  SALE\r
+  AUTH\r
+  FORCE_SALE\r
+  FORCE_AUTH\r
+  ADJUSTMENT\r
+  QUERY_PAYMENT\r
+  QUERY_CREDIT\r
+  CAPTURE\r
+  VOID\r
+  CREDIT\r
+  CREATE_ORDER\r
+  CLOSE_ORDER\r
+  CANCEL_ORDER\r
+  VOID_AUTH\r
+  VOID_CAPTURE\r
+  VOID_CREDIT\r
+  SETTLE_ACTION\r
+  PURGE_ACTION\r
+  TOTALS_ACTION\r
+  VISA\r
+  MASTERCARD\r
+  AMERICAN_EXPRESS\r
+  DISCOVER\r
+  NOVA\r
+  AMEX\r
+  DINERS\r
+  EUROCARD\r
+  CARD_BRAND_1\r
+  CARD_BRAND_2\r
+  CARD_BRAND_3\r
+  CARD_BRAND_4\r
+  CARD_BRAND_5\r
+  CARD_BRAND_6\r
+  TR_ERROR\r
+  TR_NO_ERROR\r
+  CCR_ERROR\r
+  CCR_NO_ERROR\r
+  BR_ERROR\r
+  BR_NO_ERROR\r
+  ISR_ERROR\r
+  ISR_NO_ERROR\r
+  ECLIENT_ERROR\r
+  ECLIENT_NO_ERROR\r
+  HTTP_POST_RESULT_NOTIFICATION_STRING\r
+  EMAIL_RESULT_NOTIFICATION_STRING\r
+  NO_RESULT_NOTIFICATION_STRING\r
+  EMAIL_RESULT_NOTIFICATION\r
+  HTTP_POST_RESULT_NOTIFICATION\r
+  NO_RESULT_NOTIFICATION\r
+  TCC_DEFAULT\r
+  TCC_CARDHOLDER_NOT_PRESENT_MAIL_FAX_ORDER\r
+  TCC_CARDHOLDER_NOT_PRESENT_TELEPHONE_ORDER\r
+  TCC_CARDHOLDER_NOT_PRESENT_INSTALLMENT\r
+  TCC_CARDHOLDER_NOT_PRESENT_PAYER_AUTHENTICATION\r
+  TCC_CARDHOLDER_NOT_PRESENT_SECURE_ECOMMERCE\r
+  TCC_CARDHOLDER_NOT_PRESENT_RECURRING_BILLING\r
+  TCC_CARDHOLDER_PRESENT_RETAIL_ORDER \r
+  TCC_CARDHOLDER_PRESENT_RETAIL_ORDER_WITHOUT_SIGNATURE\r
+  TCC_CARDHOLDER_PRESENT_RETAIL_ORDER_KEYED\r
+  TCC_CARDHOLDER_NOT_PRESENT_PAYER_AUTHENTICATION_ATTEMPTED\r
+  PERIOD_WEEKLY\r
+  PERIOD_BIWEEKLY\r
+  PERIOD_SEMIMONTHLY\r
+  PERIOD_MONTHLY\r
+  PERIOD_QUARTERLY\r
+  PERIOD_ANNUAL\r
+  COMMAND_ADD_CUSTOMER_ACCOUNT_ONLY\r
+  COMMAND_ADD_RECURRENCE_ONLY\r
+  COMMAND_ADD_CUSTOMER_ACCOUNT_AND_RECURRENCE\r
+  ACCOUNT_TYPE_CREDIT_CARD\r
+  STATUS_ENROLLED\r
+  STATUS_NOT_ENROLLED\r
+  STATUS_ENROLLED_BUT_AUTHENTICATION_UNAVAILABLE\r
+  AUTHENTICATION_PREFIX\r
+  CHECKING\r
+  SAVINGS\r
+  PERSONAL\r
+  CORPORATE\r
+  DIRECT_MARKETING\r
+  RETAIL\r
+  LODGING\r
+  RESTAURANT  \r
+  CHECK\r
+  OVERRIDE\r
+  NO_CHECK\r
+);\r
+\r
+sub VERSION { "Perl Plug v1.8.0" }\r
+\r
+#**\r
+# * Payment Host Information\r
+#\r
+\r
+sub PAY_HOST { "etrans.paygateway.com" }\r
+sub PAY_HOST_PATH { "/TransactionManager" }\r
+sub PAY_HOST_PORT { 443 }\r
+\r
+\r
+#**\r
+# * Response code indicating the transaction was successfully processed.\r
+#\r
+sub SUCCESSFUL_TRANSACTION { 1 }\r
+\r
+#**\r
+# * Response code indicating that a required request field was not provided\r
+# * with the request.  The required field will be identifed in the response\r
+# * code text returned from getResponseCodeText().  The field identified will\r
+# * be defined by a subclass of TransactionRequest.\r
+#\r
+sub MISSING_REQUIRED_REQUEST_FIELD { 2 }\r
+\r
+#*\r
+# * Response code indicating that the value provided to a subclass of\r
+# * TrasactionRequest for a transaction field was not valid.  The resonse\r
+# * code text returned from getResponseCodeText() will identify the\r
+# * problem and the field.\r
+# *\r
+sub INVALID_REQUEST_FIELD { 3 }\r
+\r
+#*\r
+# * Response code indicating the transaction request was illegal.  This\r
+# * can happen if a transaction is sent for an account that does not\r
+# * exist or if the account has not been configured to perform the\r
+# * requested transaction type.\r
+#\r
+sub ILLEGAL_TRANSACTION_REQUEST { 4 }\r
+\r
+#*\r
+# * Response code indicating that an error occured within the transaction\r
+# * server.  The transaction server is where this Java Transaction Client API\r
+# * connects and sends transaction data for further processing.  This type\r
+# * of error is temporary.  If one occurs maintenance staff are immediately\r
+# * signaled to correct the problem.\r
+#\r
+sub TRANSACTION_SERVER_ERROR { 5 }\r
+\r
+#**\r
+# * Response code indicating that the requested transaction is not possible.\r
+# * This can happen if the transaction request refers to a previous transaction\r
+# * that does not exist.  For example, when using the CreditCardRequest and\r
+# * CreditCardResponse classes one possible request is to perform a capture of\r
+# * funds previously authorized from a customers credit card.  If a capture\r
+# * request is sent that refers to an authorization that does not exist then\r
+# * this response code will be returned.\r
+#\r
+sub TRANSACTION_NOT_POSSIBLE  { 6 }\r
+\r
+#**\r
+# * Response code indicating that the version of the Java Transaction Client API\r
+#* being used is no longer valid.\r
+#\r
+sub INVALID_VERSION { 7 }\r
+\r
+#**\r
+# * Response code indicating that the credit card transaction was declined.\r
+# *\r
+sub CREDIT_CARD_DECLINED { 100 }\r
+\r
+#**\r
+# * Response code indicating that the Acquirer Gateway encountered an\r
+# * error.  This is a software program that handles credit card transactions.\r
+# * It accepts connections over the internet and communicates with the\r
+# * private banking network.\r
+# *\r
+sub ACQUIRER_GATEWAY_ERROR { 101 }\r
+\r
+#**\r
+# * Response code indicating that the Payment Engine encountered an\r
+# * error.  This is a software program that makes connections to an\r
+# * Aquirer Gateway.\r
+#\r
+sub PAYMENT_ENGINE_ERROR { 102 }\r
+\r
+#/////////////////////////////////////////////////////////////////////////////////////////////////////\r
+#// Constants that are permissible values for chargeBrand.\r
+#\r
+\r
+#**\r
+# * One of ten permissible values of the parameter of the setChargeType() method.\r
+# * May also be used as the chargeType parameter in the CreditCardRequest constructor.\r
+# * Indicates that the type of operation being done is a sale\r
+# * (both an authorization and a capture).\r
+# * <p>\r
+# * Other permissible values for setChargeType() are ADJUSTMENT, AUTH, CAPTURE, CREDIT, FORCE_AUTH, FORCE_SALE, QUERY_CREDIT, QUERY_PAYMENT or VOID.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getChargeType\r
+# * @see com.paygateway.CreditCardRequest#setChargeType\r
+# */\r
+sub SALE { "SALE" }\r
+\r
+#**\r
+# * Additional Charge Type\r
+# * <p>\r
+# * See above for other permissible values for setChargeType().\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getChargeType\r
+# * @see com.paygateway.CreditCardRequest#setChargeType\r
+# *\r
+sub AUTH { "AUTH" }\r
+\r
+#**\r
+# * Additional Charge Type\r
+# * <p>\r
+# * See above for other permissible values for setChargeType().\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getChargeType\r
+# * @see com.paygateway.CreditCardRequest#setChargeType\r
+# *\r
+sub CAPTURE { "CAPTURE" }\r
+\r
+#**\r
+# * Additional Charge Type\r
+# * <p>\r
+# * See above for other permissible values for setChargeType().\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getChargeType\r
+# * @see com.paygateway.CreditCardRequest#setChargeType\r
+# *\r
+sub VOID { "VOID" }\r
+\r
+#**\r
+# * Additional Charge Type\r
+# * <p>\r
+# * See above for other permissible values for setChargeType().\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getChargeType\r
+# * @see com.paygateway.CreditCardRequest#setChargeType\r
+# *\r
+sub CREDIT { "CREDIT" }\r
+\r
+#**\r
+# * Additional Charge Type\r
+# * <p>\r
+# * See above for other permissible values for setChargeType().\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getChargeType\r
+# * @see com.paygateway.CreditCardRequest#setChargeType\r
+# *\r
+sub FORCE_AUTH { "FORCE_AUTH" }\r
+\r
+#**\r
+# * Additional Charge Type\r
+# * <p>\r
+# * See above for other permissible values for setChargeType().\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getChargeType\r
+# * @see com.paygateway.CreditCardRequest#setChargeType\r
+# *\r
+sub FORCE_SALE { "FORCE_SALE" }\r
+\r
+#**\r
+# * Additional Charge Type\r
+# * <p>\r
+# * See above for other permissible values for setChargeType().\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getChargeType\r
+# * @see com.paygateway.CreditCardRequest#setChargeType\r
+# *\r
+sub QUERY_PAYMENT { "QUERY_PAYMENT" }\r
+\r
+#**\r
+# * Additional Charge Type\r
+# * <p>\r
+# * See above for other permissible values for setChargeType().\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getChargeType\r
+# * @see com.paygateway.CreditCardRequest#setChargeType\r
+# *\r
+sub QUERY_CREDIT { "QUERY_CREDIT" }\r
+\r
+#**\r
+# * Additional Charge Type\r
+# * <p>\r
+# * See above for other permissible values for setChargeType().\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getChargeType\r
+# * @see com.paygateway.CreditCardRequest#setChargeType\r
+# *\r
+sub ADJUSTMENT { "ADJUSTMENT" }\r
+\r
+\r
+\r
+\r
+\r
+# new charge types for BatchRequest\r
+# added in v1.6\r
+sub SETTLE_ACTION { "SETTLE" }\r
+sub PURGE_ACTION { "PURGE" }\r
+sub TOTALS_ACTION { "TOTALS" }\r
+\r
+# new charge types for ibm pm\r
+# added in v1.6\r
+sub CLOSE_ORDER { "CLOSE_ORDER" }\r
+sub CANCEL_ORDER { "CANCEL_ORDER" }\r
+sub CREATE_ORDER { "CREATE_ORDER" }\r
+sub VOID_AUTH { "VOID_AUTH" }\r
+sub VOID_CAPTURE { "VOID_CAPTURE" }\r
+sub VOID_CREDIT { "VOID_CREDIT" }\r
+\r
+#/////////////////////////////////////////////////////////////////////////////////////////////////////\r
+#// Permissible values for cardBrand.\r
+\r
+#\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# <p>\r
+# Other permissible values are\r
+# MASTERCARD, AMERICAN_EXPRESS, DISCOVER, NOVA, AMEX, DINERS, or EUROCARD,\r
+# as well as generic values (to support future card types)\r
+# CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_4, CARD_BRAND_5, or CARD_BRAND_6.\r
+# <p>\r
+# @see com.paygateway.CreditCardRequest#getCardBrand\r
+# @see com.paygateway.CreditCardRequest#setCardBrand\r
+#*/\r
+sub VISA {  "VISA" }\r
+\r
+#**\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# <p>\r
+# Other permissible values are\r
+# VISA, AMERICAN_EXPRESS, DISCOVER, NOVA, AMEX, DINERS, or EUROCARD,\r
+# as well as generic values (to support future card types)\r
+# CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_4, CARD_BRAND_5, or CARD_BRAND_6.\r
+# <p>\r
+# @see com.paygateway.CreditCardRequest#getCardBrand\r
+# @see com.paygateway.CreditCardRequest#setCardBrand\r
+#\r
+sub MASTERCARD  { "MASTERCARD" }\r
+\r
+#**\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# * <p>\r
+# * Other permissible values are\r
+# * VISA, MASTERCARD, DISCOVER, NOVA, AMEX, DINERS, or EUROCARD,\r
+# * as well as generic values (to support future card types)\r
+# * CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_4, CARD_BRAND_5, or CARD_BRAND_6.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getCardBrand\r
+# * @see com.paygateway.CreditCardRequest#setCardBrand\r
+# */\r
+sub AMERICAN_EXPRESS { "AMERICAN_EXPRESS" }\r
+\r
+#/**\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# * <p>\r
+# * Other permissible values are\r
+# * VISA, MASTERCARD, AMERICAN_EXPRESS, NOVA, AMEX, DINERS, or EUROCARD,\r
+# * as well as generic values (to support future card types)\r
+# * CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_4, CARD_BRAND_5, or CARD_BRAND_6.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getCardBrand\r
+# * @see com.paygateway.CreditCardRequest#setCardBrand\r
+# */\r
+sub DISCOVER  { "DISCOVER" }\r
+\r
+#**\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# * <p>\r
+# * Other permissible values are\r
+# * VISA, MASTERCARD, AMERICAN_EXPRESS, DISCOVER, AMEX, DINERS, or EUROCARD,\r
+# * as well as generic values (to support future card types)\r
+# * CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_4, CARD_BRAND_5, or CARD_BRAND_6.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getCardBrand\r
+# * @see com.paygateway.CreditCardRequest#setCardBrand\r
+# */\r
+sub NOVA { "NOVA" }\r
+\r
+#**\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# * <p>\r
+# * Other permissible values are\r
+# * VISA, MASTERCARD, AMERICAN_EXPRESS, DISCOVER, NOVA, DINERS, or EUROCARD,\r
+# * as well as generic values (to support future card types)\r
+# * CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_4, CARD_BRAND_5, or CARD_BRAND_6.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getCardBrand\r
+# * @see com.paygateway.CreditCardRequest#setCardBrand\r
+# */\r
+sub AMEX { "AMEX" }\r
+\r
+#*\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# * <p>\r
+# * Other permissible values are\r
+# * VISA, MASTERCARD, AMERICAN_EXPRESS, DISCOVER, NOVA, AMEX, or EUROCARD,\r
+# * as well as generic values (to support future card types)\r
+# * CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_4, CARD_BRAND_5, or CARD_BRAND_6.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getCardBrand\r
+# * @see com.paygateway.CreditCardRequest#setCardBrand\r
+# */\r
+sub DINERS {  "DINERS" }\r
+\r
+#*\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# * <p>\r
+# * Other permissible values are\r
+# * VISA, MASTERCARD, AMERICAN_EXPRESS, DISCOVER, NOVA, AMEX, or DINERS,\r
+# * as well as generic values (to support future card types)\r
+# * CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_4, CARD_BRAND_5, or CARD_BRAND_6.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getCardBrand\r
+# * @see com.paygateway.CreditCardRequest#setCardBrand\r
+# */\r
+sub EUROCARD  { "EUROCARD" }\r
+\r
+#**\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# * <p>\r
+# * Other permissible values are\r
+# * VISA, MASTERCARD, AMERICAN_EXPRESS, DISCOVER, NOVA, AMEX, DINERS, or EUROCARD,\r
+# * as well as generic values (to support future card types)\r
+# * CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_4, CARD_BRAND_5, or CARD_BRAND_6.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getCardBrand\r
+# * @see com.paygateway.CreditCardRequest#setCardBrand\r
+# */\r
+sub CARD_BRAND_1 { "CARD_BRAND_1" }\r
+\r
+\r
+#**\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# * <p>\r
+# * Other permissible values are\r
+# * VISA, MASTERCARD, AMERICAN_EXPRESS, DISCOVER, NOVA, AMEX, DINERS, or EUROCARD,\r
+# * as well as generic values (to support future card types)\r
+# * CARD_BRAND_1, CARD_BRAND_3, CARD_BRAND_4, CARD_BRAND_5, or CARD_BRAND_6.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getCardBrand\r
+# * @see com.paygateway.CreditCardRequest#setCardBrand\r
+# */\r
+sub CARD_BRAND_2  { "CARD_BRAND_2" }\r
+\r
+#**\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# * <p>\r
+# * Other permissible values are\r
+# * VISA, MASTERCARD, AMERICAN_EXPRESS, DISCOVER, NOVA, AMEX, DINERS, or EUROCARD,\r
+# * as well as generic values (to support future card types)\r
+# * CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_4, CARD_BRAND_5, or CARD_BRAND_6.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getCardBrand\r
+# * @see com.paygateway.CreditCardRequest#setCardBrand\r
+# */\r
+sub CARD_BRAND_3  { "CARD_BRAND_3" }\r
+\r
+#**\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# * <p>\r
+# * Other permissible values are\r
+# * VISA, MASTERCARD, AMERICAN_EXPRESS, DISCOVER, NOVA, AMEX, DINERS, or EUROCARD,\r
+# * as well as generic values (to support future card types)\r
+# * CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_5, or CARD_BRAND_6.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getCardBrand\r
+# * @see com.paygateway.CreditCardRequest#setCardBrand\r
+# */\r
+sub CARD_BRAND_4 {  "CARD_BRAND_4" }\r
+\r
+#**\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# * <p>\r
+# * Other permissible values are\r
+# * VISA, MASTERCARD, AMERICAN_EXPRESS, DISCOVER, NOVA, AMEX, DINERS, or EUROCARD,\r
+# * as well as generic values (to support future card types)\r
+# * CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_4, or CARD_BRAND_6.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getCardBrand\r
+# * @see com.paygateway.CreditCardRequest#setCardBrand\r
+# */\r
+sub CARD_BRAND_5 {  "CARD_BRAND_5" }\r
+\r
+#**\r
+# * One permissible value for the parameter of the setCardBrand() method.\r
+# * May also be used as the cardBrand parameter in the CreditCardRequest constructor.\r
+# * <p>\r
+# * Other permissible values are\r
+# * VISA, MASTERCARD, AMERICAN_EXPRESS, DISCOVER, NOVA, AMEX, DINERS, or EUROCARD,\r
+# * as well as generic values (to support future card types)\r
+# * CARD_BRAND_1, CARD_BRAND_2, CARD_BRAND_3, CARD_BRAND_4, or CARD_BRAND_5.\r
+# * <p>\r
+# * @see com.paygateway.CreditCardRequest#getCardBrand\r
+# * @see com.paygateway.CreditCardRequest#setCardBrand\r
+# */\r
+sub CARD_BRAND_6 {  "CARD_BRAND_6" }\r
+\r
+# Transaction Condition code values (CreditCardRequest)\r
+sub TCC_DEFAULT                                                { 0 }\r
+sub TCC_CARDHOLDER_NOT_PRESENT_MAIL_FAX_ORDER                  { 1 }\r
+sub TCC_CARDHOLDER_NOT_PRESENT_TELEPHONE_ORDER                         { 2 }\r
+sub TCC_CARDHOLDER_NOT_PRESENT_INSTALLMENT                     { 3 }\r
+sub TCC_CARDHOLDER_NOT_PRESENT_PAYER_AUTHENTICATION            { 4 }\r
+sub TCC_CARDHOLDER_NOT_PRESENT_SECURE_ECOMMERCE                { 5 }\r
+sub TCC_CARDHOLDER_NOT_PRESENT_RECURRING_BILLING               { 6 }\r
+sub TCC_CARDHOLDER_PRESENT_RETAIL_ORDER                        { 7 }\r
+sub TCC_CARDHOLDER_PRESENT_RETAIL_ORDER_WITHOUT_SIGNATURE      { 8 }\r
+sub TCC_CARDHOLDER_PRESENT_RETAIL_ORDER_KEYED                  { 9 }\r
+sub TCC_CARDHOLDER_NOT_PRESENT_PAYER_AUTHENTICATION_ATTEMPTED  { 10 }\r
+\r
+################################\r
+# Special Credit Card constants\r
+#\r
+# Duplicate Check\r
+#no, conflicts with perl# sub CHECK { "CHECK" }\r
+sub OVERRIDE { "OVERRIDE" }\r
+sub NO_CHECK { "NO_CHECK" }\r
+\r
+\r
+################################\r
+# Recurring billing constants\r
+#\r
+# Period\r
+sub PERIOD_WEEKLY      { 1 }\r
+sub PERIOD_BIWEEKLY    { 2 }\r
+sub PERIOD_SEMIMONTHLY { 3 }\r
+sub PERIOD_MONTHLY     { 4 }\r
+sub PERIOD_QUARTERLY   { 5 }\r
+sub PERIOD_ANNUAL      { 6 }\r
+\r
+# Command\r
+sub COMMAND_ADD_CUSTOMER_ACCOUNT_ONLY { "ADD_RECURRENCE" }\r
+sub COMMAND_ADD_RECURRENCE_ONLY { "ADD_RECURRENCE" }\r
+sub COMMAND_ADD_CUSTOMER_ACCOUNT_AND_RECURRENCE { "ADD_CUSTOMER_AND_RECURRENCE" }\r
+\r
+# Account Type\r
+sub ACCOUNT_TYPE_CREDIT_CARD { "CREDIT_CARD" }\r
+\r
+# TransactionResponse error definitions\r
+sub TR_ERROR { 0 }\r
+sub TR_NO_ERROR  { 1 }\r
+\r
+# CreditCardResponse error definitions\r
+sub CCR_ERROR {  0 }\r
+sub CCR_NO_ERROR {  1 }\r
+\r
+# BatchResponse error definitions\r
+sub BR_ERROR { 0 }\r
+sub BR_NO_ERROR { 1 }\r
+\r
+#InitSETResponse error definitions\r
+sub ISR_ERROR {  0 }\r
+sub ISR_NO_ERROR  { 1 }\r
+\r
+# EClient error definitions\r
+sub ECLIENT_ERROR {  0 }\r
+sub ECLIENT_NO_ERROR  { 1 }\r
+\r
+# ESETClient error definitions\r
+sub ESETCLIENT_ERROR {  0 }\r
+sub ESETCLIENT_NO_ERROR {  1 }\r
+\r
+\r
+# CESETClient SET result notification constants\r
+sub HTTP_POST_RESULT_NOTIFICATION_STRING { "HTTP_POST_RESULT_NOTIFICATION" }\r
+sub EMAIL_RESULT_NOTIFICATION_STRING {  "EMAIL_RESULT_NOTIFICATION" }\r
+sub NO_RESULT_NOTIFICATION_STRING  { "NO_RESULT_NOTIFICATION" }\r
+\r
+sub EMAIL_RESULT_NOTIFICATION {  1 }\r
+sub HTTP_POST_RESULT_NOTIFICATION  { 2 }\r
+sub NO_RESULT_NOTIFICATION {  3 }\r
+\r
+\r
+################################\r
+# Payer Authentication constants\r
+#\r
+\r
+# status\r
+sub STATUS_ENROLLED { "Y" }\r
+sub STATUS_NOT_ENROLLED { "N" }\r
+sub STATUS_ENROLLED_BUT_AUTHENTICATION_UNAVAILABLE { "U" }\r
+sub AUTHENTICATION_PREFIX {"authentication_"}\r
+\r
+\r
+################################\r
+# ACH constants\r
+#\r
+\r
+# Account Type\r
+sub CHECKING { 1 }\r
+sub SAVINGS  { 0 }\r
+\r
+# Account Class\r
+sub PERSONAL  { 0 }\r
+sub CORPORATE { 1 }\r
+\r
+################################\r
+# Industry type constants\r
+#\r
+\r
+# Industry Type\r
+sub DIRECT_MARKETING { "DIRECT_MARKETING" }\r
+sub RETAIL { "RETAIL" }\r
+sub LODGING { "LODGING" }\r
+sub RESTAURANT { "RESTAURANT" }\r
+\r
+1;\r
diff --git a/t/Business-OnlinePayment-PPIPayMover.t b/t/Business-OnlinePayment-PPIPayMover.t
new file mode 100644 (file)
index 0000000..7d69c0d
--- /dev/null
@@ -0,0 +1,17 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl Business-OnlinePayment-PPIPayMover.t'
+
+#########################
+
+# change 'tests => 1' to 'tests => last_test_to_print';
+
+use Test;
+BEGIN { plan tests => 1 };
+use Business::OnlinePayment::PPIPayMover;
+ok(1); # If we made it this far, we're ok.
+
+#########################
+
+# Insert your test code below, the Test::More module is use()ed here so read
+# its man page ( perldoc Test::More ) for help writing this test script.
+
diff --git a/t/bad_card.t b/t/bad_card.t
new file mode 100644 (file)
index 0000000..0895d63
--- /dev/null
@@ -0,0 +1,38 @@
+BEGIN { $| = 1; print "1..1\n"; }
+
+eval "use Net::SSLeay;";
+if ( $@ ) {
+  print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit;
+}
+
+use Business::OnlinePayment;
+
+my $tx = new Business::OnlinePayment("PPIPayMover");
+$tx->content(
+    type           => 'VISA',
+    'login'        => '195325FCC230184964CAB3A8D93EEB31888C42C714E39CBBB2E541884485D04B', #token
+    action         => 'Normal Authorization',
+    description    => 'Business::OnlinePayment visa test',
+    amount         => '0.10',
+    invoice_number => '100100',
+    customer_id    => 'jsk',
+    first_name     => 'Tofu',
+    last_name      => 'Beast',
+    address        => '123 Anystreet',
+    city           => 'Anywhere',
+    state          => 'UT',
+    zip            => '84058',
+    phone          => '420-543-2199',
+    card_number    => '4007000000027',
+    expiration     => '08/09',
+);
+$tx->test_transaction(1); # test, dont really charge
+$tx->submit();
+
+if($tx->is_success()) {
+    print "not ok 1\n";
+} else {
+    #warn $tx->server_response."\n";
+    #warn $tx->error_message. "\n";
+    print "ok 1\n";
+}
diff --git a/t/bop.t b/t/bop.t
new file mode 100644 (file)
index 0000000..64332c5
--- /dev/null
+++ b/t/bop.t
@@ -0,0 +1,5 @@
+BEGIN { $| = 1; print "1..1\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use Business::OnlinePayment;
+$loaded = 1;
+print "ok 1\n";
diff --git a/t/capture.t b/t/capture.t
new file mode 100644 (file)
index 0000000..353bf27
--- /dev/null
@@ -0,0 +1,62 @@
+BEGIN { $| = 1; print "1..2\n"; }
+
+#print "ok 1 # Skipped: no separate auth + capture test yet\n";
+#print "ok 2 # Skipped: no separate auth + capture test yet\n";
+#exit;
+
+use Business::OnlinePayment;
+
+my $tx = new Business::OnlinePayment("PPIPayMover");
+$tx->content(
+    type           => 'VISA',
+    'login'        => '195325FCC230184964CAB3A8D93EEB31888C42C714E39CBBB2E541884485D04B', #token
+    action         => 'Authorization Only',
+    description    => 'Business::OnlinePayment auth + capture test',
+    amount         => '0.01',
+    invoice_number => '100100',
+    customer_id    => '5454',
+    first_name     => 'Tofu',
+    last_name      => 'Beast',
+    address        => '123 Anystreet',
+    city           => 'Anywhere',
+    state          => 'UT',
+    zip            => '84058',
+    card_number    => '4007000000027',
+    expiration     => '08/06',
+);
+$tx->test_transaction(1); # test, dont really charge
+$tx->submit();
+
+unless($tx->is_success()) {
+    print "not ok 1\n";
+    print "not ok 2\n";
+} else {
+    my $order_number = $tx->order_number;
+    #warn $order_number;
+    print "ok 1\n";
+
+    my $settle_tx = new Business::OnlinePayment("PPIPayMover");
+    $settle_tx->content(
+      type           => 'VISA',
+    'login'        => '195325FCC230184964CAB3A8D93EEB31888C42C714E39CBBB2E541884485D04B', #token
+      action         => 'Post Authorization',
+      description    => 'Business::OnlinePayment auth + capture test',
+      amount         => '0.01',
+      invoice_number => '100100',
+      order_number   => $order_number,
+      card_number    => '4007000000027',
+      expiration     => '08/06',
+      customer_id    => '5454',
+   );
+
+    $settle_tx->test_transaction(1); # test, dont really charge
+    $settle_tx->submit();
+
+    if($settle_tx->is_success()) {
+        print "ok 2\n";
+    } else {
+        warn $settle_tx->error_message;
+        print "not ok 2\n";
+    }
+
+}
diff --git a/t/credit_card.t b/t/credit_card.t
new file mode 100644 (file)
index 0000000..3f00834
--- /dev/null
@@ -0,0 +1,39 @@
+BEGIN { $| = 1; print "1..1\n"; }
+
+eval "use Net::SSLeay;";
+if ( $@ ) {
+  print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit;
+}
+
+use Business::OnlinePayment;
+
+my $tx = new Business::OnlinePayment("PPIPayMover");
+$tx->content(
+    type           => 'VISA',
+    'login'        => '195325FCC230184964CAB3A8D93EEB31888C42C714E39CBBB2E541884485D04B', #token
+    action         => 'Normal Authorization',
+    description    => 'Business::OnlinePayment visa test',
+    amount         => '0.01',
+    invoice_number => '100100',
+    customer_id    => 'jsk',
+    first_name     => 'Tofu',
+    last_name      => 'Beast',
+    address        => '123 Anystreet',
+    city           => 'Anywhere',
+    state          => 'UT',
+    zip            => '84058',
+    phone          => '420-543-2199',
+    card_number    => '4005550000000019',
+    expiration     => '08/09',
+);
+$tx->test_transaction(1); # test, dont really charge
+$tx->submit();
+
+if($tx->is_success()) {
+    print "ok 1\n";
+} else {
+    #warn $tx->server_response."\n";
+    warn $tx->error_message. "\n";
+    print "not ok 1\n";
+}
+
diff --git a/t/load.t b/t/load.t
new file mode 100644 (file)
index 0000000..15c0bea
--- /dev/null
+++ b/t/load.t
@@ -0,0 +1,12 @@
+BEGIN {
+  $| = 1; print "1..1\n";
+  eval "use Net::SSLeay;";
+  if ( $@ ) {
+    print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit;
+  }
+
+}
+END {print "not ok 1\n" unless $loaded;}
+use Business::OnlinePayment::PPIPayMover;
+$loaded = 1;
+print "ok 1\n";
diff --git a/t/void.t b/t/void.t
new file mode 100644 (file)
index 0000000..2b17c5a
--- /dev/null
+++ b/t/void.t
@@ -0,0 +1,65 @@
+BEGIN { $| = 1; print "1..2\n"; }
+
+eval "use Net::SSLeay;";
+if ( $@ ) {
+  print "ok 1 # Skipped: Net::SSLeay is not installed\n"; exit;
+}
+
+use Business::OnlinePayment;
+
+my $tx = new Business::OnlinePayment("PPIPayMover");
+
+$tx->content(
+    type           => 'VISA',
+    'login'        => '195325FCC230184964CAB3A8D93EEB31888C42C714E39CBBB2E541884485D04B', #token
+    action         => 'Normal Authorization',
+    description    => 'Business::OnlinePayment void test',
+    amount         => '0.01',
+    card_number    => '4445999922225',
+    expiration     => '03/10',
+    cvv2           => '999',
+    name           => 'Tofu Beast',
+    address        => '8320',
+    city           => 'Anywhere',
+    state          => 'UT',
+    zip            => '85284',
+    phone          => '415-420-5454',
+    email          => 'ivan-ppipaymover-test@420.am',
+    customer_id    => '5454',
+);
+$tx->test_transaction(1); # test, dont really charge
+$tx->submit();
+
+if($tx->is_success()) {
+    print "ok 1\n";
+} else {
+    #warn $tx->server_response."\n";
+    warn $tx->error_message. "\n";
+    print "not ok 1\n";
+}
+
+my $v_tx = new Business::OnlinePayment("PPIPayMover");
+
+$v_tx->content(
+    type           => 'VISA',
+    'login'        => '195325FCC230184964CAB3A8D93EEB31888C42C714E39CBBB2E541884485D04B', #token
+    action         => 'Void',
+    description    => 'Business::OnlinePayment::PPIPayMover test',
+    customer_id    => '5454',
+    order_number   => $tx->order_number(),
+);
+
+$v_tx->test_transaction(1); # test, dont really charge
+$v_tx->submit();
+
+if($v_tx->is_success()) {
+    print "ok 2\n";
+} else {
+    #warn $v_tx->server_response."\n";
+    warn $v_tx->error_message. "\n";
+    print "not ok 2\n";
+}
+
+
+
+