+ if ($content->{'returns_method'} eq 'transret') {
+ $Business::OnlinePayment::HTTPS::DEBUG = $DEBUG;
+ if (defined($content->{'login'}) and defined($content->{'password'})) {
+ # date range doesn't work quite right with transret
+ my $path = ('transret.php?style=csv&sort=id&date=');
+ my $starttime = str2time($self->_start);
+ my $endtime = str2time($self->_end) - 1;
+ $DB::single=1;
+ my @months = map { s/^(....)(..)$/$1-$2-01/; $_ } (
+ time2str('%Y%m', $starttime)..time2str('%Y%m', $endtime)
+ );
+ my $headers = {
+ Authorization => 'Basic ' . MIME::Base64::encode($content->{'login'} . ':' . $content->{'password'})
+ };
+ my @tids;
+ foreach my $m (@months) {
+ $self->path($path . $m);
+ my ($page, $reply, %headers) =
+ $self->https_get(
+ { headers => $headers },
+ {},
+ );
+ if ($reply =~ /^200/) {
+ $self->is_success(1);
+ }
+ else {
+ $self->error_message($reply);
+ carp $page if $DEBUG > 1;
+ $self->is_success(0);
+ return;
+ }
+ foreach my $trans (split("\cJ", $page)) {
+ my @fields = split(',', $trans);
+ # fields:
+ # id, Date Returned, Type, Amount, Name, Customer ID Number, Email Address, Invoice Number, Status Code, SEC
+ # we only care about id and date.
+ next if scalar(@fields) < 10;
+ next if not($fields[0] =~ /^\d+$/);
+ my $rettime = str2time($fields[1]);
+ next if (!$rettime or $rettime < $starttime or $rettime > $endtime);
+ carp $trans if $DEBUG > 1;
+ push @tids, $fields[0];
+ }
+ }
+ return @tids;