$ sudo apt-get update && apt-get upgrade -y
$ sudo perl -MCPAN -e "install Net::eBay"
Three scripts were hacked together to make this work, the ebay-...pl scripts were came directly from the Net::eBay documentation page. Remember to put your ebay developer production keys in the same directory in a file called ebay.ini
Part I
Shell script that calls the perl scripts and finds all item numbers that we have not already left feedback for:
1: #!/bin/bash
2: #
3: # Automatically leaves feedback for sold transactions when run from a cron job like so:
4: # 00 1 * * * /usr/bin/bash /path/to/this/script.sh > /dev/null 2&>1
5: EBAY_USER=USERNAME
6: LINUX_USERNAME=joe
7: FEEDBACK="\"Great Buyer, Fast Payment, Thanks! A+++++\""
8: for item in `/usr/bin/perl /home/$LINUX_USERNAME/code/ebay/ebay-get-my-sold.pl $EBAY_USER --sold | /bin/grep ItemID | /usr/bin/awk '{print $3;}' | /usr/bin/perl -pe "s/'(\d+)',?/\1/g" | /usr/bin/sort | /usr/bin/uniq` ;
9: do
10: if /bin/grep -Fxq "$item" /home/$LINUX_USERNAME/code/ebay/item_log
11: then<br>
12: /bin/echo "$item already left feedback for this item"
13: else
14: /home/$LINUX_USERNAME/code/ebay/ebay-leave-feedback.pl $item $FEEDBACK
15: /bin/echo $item >> /home/$LINUX_USERNAME/code/ebay/item_log
16: fi
17: done
Part II
This script is supposed to print all your active or sold auctions in nicely formatted columns. I couldn't get it to dereference the correct array or scalar to work, so I just uncommented the datadumper line and grep through to find item id's. Perhaps the eBay API has modified their XML Schema and the Net::eBay module has yet to make the modifications.
Here's the link to the script: ebay-get-my-sold.pl
1: #!/usr/bin/perl
2: use strict;
3: use warnings;
4: use Net::eBay;
5: use Data::Dumper;
6: my $eBay = new Net::eBay;
7: # use new eBay API
8: $eBay->setDefaults( { API => 2, debug => 0 } );
9: #my $seller = shift @ARGV || die "Usage: $0 seller-id";
10: my $kind = 'ActiveList';
11: my $status = 'active';
12: if( @ARGV && $ARGV[0] eq '--sold' ) {
13: shift @ARGV;
14: $kind = 'SoldList';
15: $status = 'sold';
16: }
17: my $result = $eBay->submitRequest( "GetMyeBaySelling",
18: {
19: $kind => {
20: Sort => 'EndTime',
21: Pagination => {
22: EntriesPerPage => 199,
23: PageNumber => 1
24: }
25: }
26: }
27: );
28: if( ref $result ) {
29: print "Result: " . Dumper( $result ) . "\n";
30: print " Item W B Price Q Title\n";
31: #7551933377 0 0 49.99 1 Siliconix Transistor tester IPT II 2 Monitor
32: my $arrayref;
33: if( $status eq 'active' ) {
34: $arrayref = $result->{$kind}->{ItemArray}->{Item};
35: } elsif( $status eq 'sold' ) {
36: $arrayref = $result->{$kind}->{OrderTransactionArray}->{Item};
37: }
38: foreach my $item (@$arrayref) {
39: print "$item->{ItemID} ";
40: print sprintf( "%3d ", $item->{WatchCount} || 0 );
41: print sprintf( "%2d ", $item->{SellingStatus}->{BidCount} || 0 );
42: print sprintf( "%7.2f ", $item->{SellingStatus}->{CurrentPrice}->{content} );
43: print "$item->{Quantity} $item->{Title} ";
44: print "\n";
45: }
46: print "$result->{SellingSummary}->{AuctionBidCount} bids\n";
47: } else {
48: print "Unparsed result: \n$result\n\n";
49: }
Part III
This script actually leaves the feedback for an item, you call it like so:
./ebay-leave-feedback.pl ITEMNUMBER "Feedback to be left"
Get the Code from here ebay-leave-feedback.pl
1: #!/usr/bin/perl
2: use strict;
3: use warnings;
4: use Net::eBay;
5: use Data::Dumper;
6: use DateTime::Precise;
7: use Getopt::Long;
8: my $usage = "Usage: $0 item-id{,item-id} feedback text\nNote:no spaces between item ids, ONLY COMMAS";
9: die $usage unless @ARGV;
10: my ($detail, $debug);
11: GetOptions(
12: "debug!" => \$debug,
13: );
14: my $eBay = new Net::eBay;
15: # use new eBay API
16: $eBay->setDefaults( { API => 2, debug => $debug } );
17: my $exitcode = 0;
18: my $items = shift @ARGV || die $usage;
19: foreach my $item ( split( /,/, $items ) ) {
20: die $usage unless $item =~ /^\d+$/;
21: my $text = join( ' ', @ARGV ) or die $usage;
22: my $result = $eBay->submitRequest( "GetItem",
23: {
24: ItemID => $item
25: }
26: );
27: if( ref $result ) {
28: if( $debug ) {
29: print "Result: " . Dumper( $result ) . "\n";
30: }
31: my $high_bidder = $result->{Item}->{SellingStatus}->{HighBidder}->{UserID};
32: if( $high_bidder ) {
33: my $fb = {
34: ItemID => $item,
35: TargetUser => $high_bidder,
36: CommentType => 'Positive',
37: CommentText => $text
38: };
39: my $fbresult = $eBay->submitRequest( "LeaveFeedback", $fb );
40: print "$item ($result->{Item}->{Title}): $fbresult->{Ack}\n";
41: unless( $fbresult->{Ack} eq 'Success' ) {
42: #print Dumper( $fbresult );
43: my $msg = $fbresult->{Errors}->{LongMessage};
44: print "Why: $msg\n";
45: if ( $msg =~ /Transaction ID is required/ ) {
46: print STDERR "Feedback for multiple quantity items is not supported.\n";
47: $exitcode = 0;
48: } elsif ( $msg =~ /or the feedback has been left already/ ) {
49: print STDERR "You already left feedback for this transaction.\n";
50: $exitcode = 1;
51: } else {
52: $exitcode = 1;
53: }
54: } else {
55: print STDERR "Success! $high_bidder $item <-- data-blogger-escaped-code="" data-blogger-escaped-else="" data-blogger-escaped-exit="" data-blogger-escaped-exitcode="" data-blogger-escaped-found.="" data-blogger-escaped-item="" data-blogger-escaped-n="" data-blogger-escaped-not="" data-blogger-escaped-nparsed="" data-blogger-escaped-print="" data-blogger-escaped-result:="" data-blogger-escaped-result="" data-blogger-escaped-stderr="" data-blogger-escaped-tem="" data-blogger-escaped-text="">