$self->path('/process.cgi');
$self->build_subs(qw(
- receipt_number sales_number
- card_type
+ receipt_number sales_number uuid guid
+ date
+ card_type cardholder
total_amount
avs_response cvv2_response
));
return %new;
}
-# OnlinePayment's remap_fields is buggy, so we simply rewrite it
-#
-sub remap_fields {
- my ($self, %map) = @_;
-
- my %content = $self->content();
- foreach (keys %map) {
- $content{$map{$_}} = delete $content{$_};
- }
- $self->content(%content);
-}
-
# Combine get_fields and remap_fields for convenience
#
sub get_remap_fields {
}
xml_out(\%data,
- NoAttr => 1,
- RootName => 'TranxRequest',
- SuppressEmpty => undef,
- XMLDecl => '<?xml version="1.0" encoding="utf-8" standalone="yes"?>',
+ NoAttr => 1,
+ NumericEscape => 2,
+ RootName => 'TranxRequest',
+ SuppressEmpty => undef,
+ XMLDecl => '<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>',
);
}
while (my ($k, $v) = each %map) {
no strict 'refs';
- $self->$v($data->{$k});
+ $self->$k($data->{$v});
}
}
my ($self, $response) = @_;
$self->server_response($response);
+
+ local $/ = "\n"; # Make sure to avoid bug #17687
$response = xml_in($response,
ForceArray => [qw(product flag)],
my $code = $self->result_code($response->{Page});
$self->is_success($code eq '2000' || $code eq '90000' || $code eq '900P1');
- $self->infuse($response, qw(
- ReceiptNumber receipt_number
- SalesOrderNumber sales_number
- CardType card_type
- Page result_code
- ApprovalCode authorization
- Verbiage error_message
- TotalAmount total_amount
- AVSResponseCode avs_response
- CVV2ResponseCode cvv2_response
- ));
+ $self->infuse($response,
+ result_code => 'Page',
+ error_message => 'Verbiage',
+ authorization => 'ApprovalCode',
+ avs_response => 'AVSResponseCode',
+ cvv2_response => 'CVV2ResponseCode',
+
+ receipt_number => 'ReceiptNumber',
+ sales_number => 'SalesOrderNumber',
+ uuid => 'GUID',
+ guid => 'GUID',
+
+ date => 'Date',
+ cardholder => 'xxxName',
+ card_type => 'CardType',
+ total_amount => 'TotalAmount',
+ );
# Completely undocumented field that sometimes override <Verbiage>
$self->error_message($response->{Error}) if $response->{Error};
undef,
make_form(
xxxRequestMode => 'X',
- xxxRequestData => Encode::encode_utf8(
- $self->to_xml
- ),
+ xxxRequestData => $self->to_xml,
)
);
croak 'Error connecting to server' unless $page;
croak 'Server responded, but not in XML' unless $page =~ /^<\?xml/;
+ # The response is marked UTF-8, but it's really Latin-1. Sigh.
+ $page =~ s/^(<\?xml.*?) encoding="utf-8"/$1 encoding="iso-8859-1"/si;
+
$self->parse_response($page);
}
Sales order number of this transaction. This is a number, unique to each
merchant, which is incremented by 1 each time.
+=item uuid()
+
+Universally Unique Identifier associated to this transaction. This is a
+128-bit value returned as a 36-character string such as
+C<f81d4fae-7dec-11d0-a765-00a0c91e6bf6>. See RFC 4122 for more details on
+UUIDs.
+
+B<guid>() is provided as an alias to this method.
+
+=item date()
+
+Date and time of the transaction. Format is C<YYYY/MM/DD hh:mm:ss>.
+
=item total_amount()
Total amount billed for this order, including taxes.
+=item cardholder()
+
+Cardholder's name. This is currently a mere copy of the B<name> field passed
+to B<submit()>.
+
=item card_type()
Type of the credit card used for the submitted order, being one of the