Business-OnlinePayment-IPayment
view release on metacpan or search on metacpan
lib/Business/OnlinePayment/IPayment/Response.pm view on Meta::CPAN
package Business::OnlinePayment::IPayment::Response;
use strict;
use warnings;
use utf8;
use Digest::MD5 qw/md5_hex/;
use Moo;
=encoding utf8
=head1 NAME
Business::OnlinePayment::IPayment::Response - Helper class for Ipayment responses
=head1 SYNOPSIS
# where %params are the GET parameters
$ipayres = Business::OnlinePayment::IPayment::Response->new(%params);
$ipayres->set_credentials(
my_amount => "5000",
my_currency => "EUR",
my_userid => "99999",
my_security_key => "testtest",
);
ok($ipayres->is_success && $ipayres->is_valid, "Payment looks ok");
=head1 DESCRIPTION
=head2 ACCESSORS
=over 4
=item ret_transtime
Time of transaction.
=cut
has ret_transtime => (is => 'ro',
default => sub { return "" });
=item ret_transdate
Date of the transaction.
=cut
has ret_transdate => (is => 'ro',
default => sub { return "" });
=item ret_errorcode
The error code of 0 means that the transaction was successful. When in
a CGI integration mode parameter redirect_needed returned with the
value 1 is the only means that all data is correct and a redirect must
be running. The return value is meaningful only after a second call.
=cut
has ret_errorcode => (is => 'ro',
default => sub { return "" });
=item redirect_needed
This parameter is set if the payment could not be completed because of
a redirect necessary.
=cut
=item ret_errormsg
Error message (in German). This is important to propagate to the web
interface.
=cut
has ret_errormsg => (is => 'ro',
default => sub { return "" });
lib/Business/OnlinePayment/IPayment/Response.pm view on Meta::CPAN
has invoice_text => (is => 'ro',
default => sub { return "" });
=head3 trx_user_comment
Comment that is stored in the transaction in ipayment system. this
comment is not sent to the bank or payment processor.
This can be sent into the options as C<options->{trxUserComment}>
=cut
has trx_user_comment => (is => 'ro',
default => sub { return "" });
=head2 Storage accessors
=head3 datastorage_expirydate
The date as returned by the ipayment server (like: 2008/09/15)
=cut
has datastorage_expirydate => (is => 'ro',
default => sub { return "" });
=head3 storage_id
The storage id for the current transaction.
=cut
has storage_id => (is => 'ro',
default => sub { return "" });
=head3 trx_issuer_avs_response
AVS related response.p. 62 of the doc
=cut
has trx_issuer_avs_response => (is => 'ro',
default => sub { return "" });
=head3 trx_payauth_status
3D-related response, p. 62 of the doc
=cut
has trx_payauth_status => (is => 'ro',
default => sub { return "" });
=head2 METHODS
=head3 set_credentials(%hash)
As a shortcut, you can set the above attribute using this method
=cut
sub set_credentials {
my ($self, %args) = @_;
if (defined $args{my_userid}) {
$self->my_userid($args{my_userid});
}
if (defined $args{my_security_key}) {
$self->my_security_key($args{my_security_key});
}
if (defined $args{my_amount}) {
$self->my_amount($args{my_amount})
}
if (defined $args{my_currency}) {
$self->my_currency($args{my_currency});
}
}
=head3 is_success
Return true if the transaction was successful, undef otherwise
=cut
sub is_success {
my $self = shift;
if ($self->ret_status eq 'SUCCESS' and !$self->ret_errorcode) {
return 1;
}
else {
return undef;
}
}
=head3 is_error
Return true if the transaction raised an error, undef otherwise.
You can access the German error message with the accessor
C<ret_errormsg>
=cut
sub is_error {
my $self = shift;
if ($self->ret_status eq 'ERROR') {
return 1;
}
else {
return undef;
}
}
=head3 is_valid
Return true if the servers return a checksum (for this you have to
build a session with C<trx_securityhash> for this to work, and you
should use the app_security_key).
CGI Name: C<ret_param_checksum>
Data type: String
( run in 0.219 second using v1.01-cache-2.11-cpan-bf8d7bb2d05 )