summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeff <jeff>2010-07-17 04:25:03 +0000
committerjeff <jeff>2010-07-17 04:25:03 +0000
commita7ffdf742b491ad38126db36efe8f478ac7c1c9c (patch)
tree38b1cd37d8857e0b18eb68d819c668b453f93b6c
parent1d277ada8a9d43a42ae4f624ff0f03d63f41551c (diff)
quick routing code validation for a better error message
-rw-r--r--Changes1
-rw-r--r--IPPay.pm19
2 files changed, 20 insertions, 0 deletions
diff --git a/Changes b/Changes
index 613eb92..cbc09c3 100644
--- a/Changes
+++ b/Changes
@@ -3,6 +3,7 @@ Revision history for Perl extension Business::OnlinePayment::IPPay.
0.05 unreleased
- add introspection info used in Business::OnlinePayment 3.01+
- (0.05_02) add ECHECK_void_requires_account to introspection info
+ - add a quick routing_code validation for a better error message
0.04 Tue Jul 22 12:19:54 2008 EDT
- force country and ship country to ISA-3166-alpha-3
diff --git a/IPPay.pm b/IPPay.pm
index ab063cb..c58e14a 100644
--- a/IPPay.pm
+++ b/IPPay.pm
@@ -213,6 +213,14 @@ sub submit {
$self->required_fields(@required_fields);
+ #quick validation because ippay dumps an error indecipherable to the end user
+ if (grep { /^routing_code$/ } @required_fields) {
+ unless( $content{routing_code} =~ /^\d{9}$/ ) {
+ $self->_error_response('Invalid routing code');
+ return;
+ }
+ }
+
if ($self->test_transaction()) {
$self->server('test1.jetpay.com');
$self->port('443');
@@ -408,6 +416,17 @@ sub submit {
}
+sub _error_response {
+ my ($self, $error_message) = (shift, shift);
+ $self->result_code('');
+ $self->order_number('');
+ $self->authorization('');
+ $self->cvv2_response('');
+ $self->avs_code('');
+ $self->is_success( 0);
+ $self->error_message($error_message);
+}
+
sub _xmlwrite {
my ($self, $writer, $item, $value) = @_;
$writer->startTag($item);