projects
/
Business-OnlinePayment-InternetSecure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adjusted description of address fields
[Business-OnlinePayment-InternetSecure.git]
/
InternetSecure.pm
diff --git
a/InternetSecure.pm
b/InternetSecure.pm
index
58a6ce7
..
a14fca9
100755
(executable)
--- a/
InternetSecure.pm
+++ b/
InternetSecure.pm
@@
-18,8
+18,9
@@
our $VERSION = '0.01';
use constant CARD_TYPES => {
VI => 'Visa',
MC => 'MasterCard',
use constant CARD_TYPES => {
VI => 'Visa',
MC => 'MasterCard',
- AX => 'American Express',
+ AX => 'American Express',
# FIXME: AM?
NN => 'Discover',
NN => 'Discover',
+ # JB?
};
};
@@
-43,6
+44,18
@@
sub set_defaults {
));
}
));
}
+# OnlinePayment's get_fields now filters out undefs in 3.x. :(
+#
+sub get_fields {
+ my ($self, @fields) = @_;
+
+ my %content = $self->content;
+
+ my %new = map +($_ => $content{$_}), @fields;
+
+ return %new;
+}
+
# OnlinePayment's remap_fields is buggy, so we simply rewrite it
#
sub remap_fields {
# OnlinePayment's remap_fields is buggy, so we simply rewrite it
#
sub remap_fields {
@@
-63,10
+76,6
@@
sub get_remap_fields {
$self->remap_fields(reverse %map);
my %data = $self->get_fields(keys %map);
$self->remap_fields(reverse %map);
my %data = $self->get_fields(keys %map);
- foreach (values %data) {
- $_ = '' unless defined;
- }
-
return %data;
}
return %data;
}
@@
-149,7
+158,7
@@
sub to_xml {
$content{taxes} = uc $content{taxes};
my %data = $self->get_remap_fields(qw(
$content{taxes} = uc $content{taxes};
my %data = $self->get_remap_fields(qw(
- xxxCard
Number
card_number
+ xxxCard
_Number
card_number
xxxName name
xxxCompany company
xxxName name
xxxCompany company
@@
-174,7
+183,8
@@
sub to_xml {
$data{MerchantNumber} = $self->merchant_id;
$data{MerchantNumber} = $self->merchant_id;
- $data{xxxCardNumber} =~ tr/ //d;
+ $data{xxxCard_Number} =~ tr/ //d;
+ $data{xxxCard_Number} =~ s/^[0-36-9]/4/ if $self->test_transaction;
my ($y, $m) = $self->parse_expdate($content{exp_date});
$data{xxxCCYear} = sprintf '%.4u' => $y;
my ($y, $m) = $self->parse_expdate($content{exp_date});
$data{xxxCCYear} = sprintf '%.4u' => $y;
@@
-207,6
+217,7
@@
sub to_xml {
xml_out(\%data,
NoAttr => 1,
RootName => 'TranxRequest',
xml_out(\%data,
NoAttr => 1,
RootName => 'TranxRequest',
+ SuppressEmpty => undef,
XMLDecl => '<?xml version="1.0" encoding="utf-8" standalone="yes"?>',
);
}
XMLDecl => '<?xml version="1.0" encoding="utf-8" standalone="yes"?>',
);
}
@@
-253,6
+264,9
@@
sub parse_response {
CVV2ResponseCode cvv2_response
));
CVV2ResponseCode cvv2_response
));
+ # Completely undocumented field that sometimes override <Verbiage>
+ $self->error_message($response->{Error}) if $response->{Error};
+
$self->card_type(CARD_TYPES->{$self->card_type});
$self->{products_raw} = $response->{Products};
$self->card_type(CARD_TYPES->{$self->card_type});
$self->{products_raw} = $response->{Products};
@@
-437,9
+451,8
@@
separating them with spaces, such as C<GST HST>.
=item name / company / address / city / state / zip / country / phone / email
=item name / company / address / city / state / zip / country / phone / email
-Facultative customer information. B<state> should be either a postal
-abbreviation or a two-letter code taken from ISO 3166-2, and B<country> should
-be a two-letter code taken from ISO 3166-1.
+Customer information. B<Country> should be a two-letter code taken from ISO
+3166-1.
=back
=back
@@
-509,7
+522,7
@@
Unit price of this product.
=item quantity
=item quantity
-Ordered quantity of this product.
This can be a decimal value.
+Ordered quantity of this product.
=item sku
=item sku