Business-OnlinePayment-IPayment

 view release on metacpan or  search on metacpan

lib/Business/OnlinePayment/IPayment/Response.pm  view on Meta::CPAN


=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

lib/Business/OnlinePayment/IPayment/Response.pm  view on Meta::CPAN


=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})
    }

t/payment.t  view on Meta::CPAN


my %urls = (
            success_url => "http://linuxia.de/ipayment/success",
            failure_url => "http://linuxia.de/ipayment/failure",
           );

$faulty{wsdl_file} = File::Spec->catfile("t", "ipayment.wsdl");

# incrementally add the data to the hash

# please note that we want to die here, as without the credentials is
# not going to work, and should be provided when the object is
# created.
foreach my $k (qw/accountid trxuserid trxpassword/) {
    eval { $faultybopi =
             Business::OnlinePayment::IPayment->new(%faulty, %urls);
           $faultybopi->session_id;
       };
    # test all the bad values
    ok($@, "Error: $@");
    $faulty{$k} = $accdata{$k};

t/payment.t  view on Meta::CPAN

ok($secbopi->debug->request->content, "We can inspect the SOAP request");

# diag Dumper($response->header('location'));
test_success($response);

my $ipayres = $secbopi->get_response_obj($response->header('location'));

# we build this anew, as in the web it will be a fresh request, so we
# don't do nothing about the previous one.

$ipayres->set_credentials(
                          my_amount   => $secbopi->trx_obj->trxAmount,
                          my_currency => $secbopi->trx_obj->trxCurrency,
                          # my_userid   => $secbopi->trxuserid,
                          # my_security_key => $secbopi->app_security_key,
                         );

ok($ipayres->url_is_valid, "Url is ok");
ok($ipayres->is_valid, "Payment looks ok");
ok(!$ipayres->validation_errors, "No errors found");
is($ipayres->paydata_cc_number, 'XXXXXXXXXXXX1111', "CC num returned masked");



( run in 0.289 second using v1.01-cache-2.11-cpan-4d50c553e7e )